{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.StartTimecode where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:timecode:StartTimecode' :: Maybe Text
timecode = 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 :: Lens' StartTimecode (Maybe Text)
startTimecode_timecode = 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 Data.FromJSON StartTimecode where
  parseJSON :: Value -> Parser StartTimecode
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StartTimecode"
      ( \Object
x ->
          Maybe Text -> StartTimecode
StartTimecode' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"timecode")
      )

instance Prelude.Hashable StartTimecode where
  hashWithSalt :: Int -> StartTimecode -> Int
hashWithSalt Int
_salt StartTimecode' {Maybe Text
timecode :: Maybe Text
$sel:timecode:StartTimecode' :: StartTimecode -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timecode

instance Prelude.NFData StartTimecode where
  rnf :: StartTimecode -> ()
rnf StartTimecode' {Maybe Text
timecode :: Maybe Text
$sel:timecode:StartTimecode' :: StartTimecode -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timecode

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