{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MediaLive.Types.StartTimecode
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.StartTimecode where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Settings to identify the start of the clip.
--
-- /See:/ 'newStartTimecode' smart constructor.
data StartTimecode = StartTimecode'
  { -- | The timecode for the frame where you want to start the clip. Optional;
    -- if not specified, the clip starts at first frame in the file. Enter the
    -- timecode as HH:MM:SS:FF or HH:MM:SS;FF.
    StartTimecode -> Maybe Text
timecode :: Prelude.Maybe Prelude.Text
  }
  deriving (StartTimecode -> StartTimecode -> Bool
(StartTimecode -> StartTimecode -> Bool)
-> (StartTimecode -> StartTimecode -> Bool) -> Eq StartTimecode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartTimecode -> StartTimecode -> Bool
$c/= :: StartTimecode -> StartTimecode -> Bool
== :: StartTimecode -> StartTimecode -> Bool
$c== :: StartTimecode -> StartTimecode -> Bool
Prelude.Eq, ReadPrec [StartTimecode]
ReadPrec StartTimecode
Int -> ReadS StartTimecode
ReadS [StartTimecode]
(Int -> ReadS StartTimecode)
-> ReadS [StartTimecode]
-> ReadPrec StartTimecode
-> ReadPrec [StartTimecode]
-> Read StartTimecode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartTimecode]
$creadListPrec :: ReadPrec [StartTimecode]
readPrec :: ReadPrec StartTimecode
$creadPrec :: ReadPrec StartTimecode
readList :: ReadS [StartTimecode]
$creadList :: ReadS [StartTimecode]
readsPrec :: Int -> ReadS StartTimecode
$creadsPrec :: Int -> ReadS StartTimecode
Prelude.Read, Int -> StartTimecode -> ShowS
[StartTimecode] -> ShowS
StartTimecode -> String
(Int -> StartTimecode -> ShowS)
-> (StartTimecode -> String)
-> ([StartTimecode] -> ShowS)
-> Show StartTimecode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartTimecode] -> ShowS
$cshowList :: [StartTimecode] -> ShowS
show :: StartTimecode -> String
$cshow :: StartTimecode -> String
showsPrec :: Int -> StartTimecode -> ShowS
$cshowsPrec :: Int -> StartTimecode -> ShowS
Prelude.Show, (forall x. StartTimecode -> Rep StartTimecode x)
-> (forall x. Rep StartTimecode x -> StartTimecode)
-> Generic StartTimecode
forall x. Rep StartTimecode x -> StartTimecode
forall x. StartTimecode -> Rep StartTimecode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartTimecode x -> StartTimecode
$cfrom :: forall x. StartTimecode -> Rep StartTimecode x
Prelude.Generic)

-- |
-- Create a value of 'StartTimecode' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'timecode', 'startTimecode_timecode' - The timecode for the frame where you want to start the clip. Optional;
-- if not specified, the clip starts at first frame in the file. Enter the
-- timecode as HH:MM:SS:FF or HH:MM:SS;FF.
newStartTimecode ::
  StartTimecode
newStartTimecode :: StartTimecode
newStartTimecode =
  StartTimecode' :: Maybe Text -> StartTimecode
StartTimecode' {$sel:timecode:StartTimecode' :: Maybe Text
timecode = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The timecode for the frame where you want to start the clip. Optional;
-- if not specified, the clip starts at first frame in the file. Enter the
-- timecode as HH:MM:SS:FF or HH:MM:SS;FF.
startTimecode_timecode :: Lens.Lens' StartTimecode (Prelude.Maybe Prelude.Text)
startTimecode_timecode :: (Maybe Text -> f (Maybe Text)) -> StartTimecode -> f StartTimecode
startTimecode_timecode = (StartTimecode -> Maybe Text)
-> (StartTimecode -> Maybe Text -> StartTimecode)
-> Lens StartTimecode StartTimecode (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTimecode' {Maybe Text
timecode :: Maybe Text
$sel:timecode:StartTimecode' :: StartTimecode -> Maybe Text
timecode} -> Maybe Text
timecode) (\s :: StartTimecode
s@StartTimecode' {} Maybe Text
a -> StartTimecode
s {$sel:timecode:StartTimecode' :: Maybe Text
timecode = Maybe Text
a} :: StartTimecode)

instance Core.FromJSON StartTimecode where
  parseJSON :: Value -> Parser StartTimecode
parseJSON =
    String
-> (Object -> Parser StartTimecode)
-> Value
-> Parser StartTimecode
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StartTimecode"
      ( \Object
x ->
          Maybe Text -> StartTimecode
StartTimecode' (Maybe Text -> StartTimecode)
-> Parser (Maybe Text) -> Parser StartTimecode
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timecode")
      )

instance Prelude.Hashable StartTimecode

instance Prelude.NFData StartTimecode

instance Core.ToJSON StartTimecode where
  toJSON :: StartTimecode -> Value
toJSON StartTimecode' {Maybe Text
timecode :: Maybe Text
$sel:timecode:StartTimecode' :: StartTimecode -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"timecode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
timecode]
      )