{-# 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.StopTimecode
-- 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.StopTimecode where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.LastFrameClippingBehavior
import qualified Amazonka.Prelude as Prelude

-- | Settings to identify the end of the clip.
--
-- /See:/ 'newStopTimecode' smart constructor.
data StopTimecode = StopTimecode'
  { -- | If you specify a StopTimecode in an input (in order to clip the file),
    -- you can specify if you want the clip to exclude (the default) or include
    -- the frame specified by the timecode.
    StopTimecode -> Maybe LastFrameClippingBehavior
lastFrameClippingBehavior :: Prelude.Maybe LastFrameClippingBehavior,
    -- | The timecode for the frame where you want to stop the clip. Optional; if
    -- not specified, the clip continues to the end of the file. Enter the
    -- timecode as HH:MM:SS:FF or HH:MM:SS;FF.
    StopTimecode -> Maybe Text
timecode :: Prelude.Maybe Prelude.Text
  }
  deriving (StopTimecode -> StopTimecode -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopTimecode -> StopTimecode -> Bool
$c/= :: StopTimecode -> StopTimecode -> Bool
== :: StopTimecode -> StopTimecode -> Bool
$c== :: StopTimecode -> StopTimecode -> Bool
Prelude.Eq, ReadPrec [StopTimecode]
ReadPrec StopTimecode
Int -> ReadS StopTimecode
ReadS [StopTimecode]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopTimecode]
$creadListPrec :: ReadPrec [StopTimecode]
readPrec :: ReadPrec StopTimecode
$creadPrec :: ReadPrec StopTimecode
readList :: ReadS [StopTimecode]
$creadList :: ReadS [StopTimecode]
readsPrec :: Int -> ReadS StopTimecode
$creadsPrec :: Int -> ReadS StopTimecode
Prelude.Read, Int -> StopTimecode -> ShowS
[StopTimecode] -> ShowS
StopTimecode -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopTimecode] -> ShowS
$cshowList :: [StopTimecode] -> ShowS
show :: StopTimecode -> String
$cshow :: StopTimecode -> String
showsPrec :: Int -> StopTimecode -> ShowS
$cshowsPrec :: Int -> StopTimecode -> ShowS
Prelude.Show, forall x. Rep StopTimecode x -> StopTimecode
forall x. StopTimecode -> Rep StopTimecode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopTimecode x -> StopTimecode
$cfrom :: forall x. StopTimecode -> Rep StopTimecode x
Prelude.Generic)

-- |
-- Create a value of 'StopTimecode' 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:
--
-- 'lastFrameClippingBehavior', 'stopTimecode_lastFrameClippingBehavior' - If you specify a StopTimecode in an input (in order to clip the file),
-- you can specify if you want the clip to exclude (the default) or include
-- the frame specified by the timecode.
--
-- 'timecode', 'stopTimecode_timecode' - The timecode for the frame where you want to stop the clip. Optional; if
-- not specified, the clip continues to the end of the file. Enter the
-- timecode as HH:MM:SS:FF or HH:MM:SS;FF.
newStopTimecode ::
  StopTimecode
newStopTimecode :: StopTimecode
newStopTimecode =
  StopTimecode'
    { $sel:lastFrameClippingBehavior:StopTimecode' :: Maybe LastFrameClippingBehavior
lastFrameClippingBehavior =
        forall a. Maybe a
Prelude.Nothing,
      $sel:timecode:StopTimecode' :: Maybe Text
timecode = forall a. Maybe a
Prelude.Nothing
    }

-- | If you specify a StopTimecode in an input (in order to clip the file),
-- you can specify if you want the clip to exclude (the default) or include
-- the frame specified by the timecode.
stopTimecode_lastFrameClippingBehavior :: Lens.Lens' StopTimecode (Prelude.Maybe LastFrameClippingBehavior)
stopTimecode_lastFrameClippingBehavior :: Lens' StopTimecode (Maybe LastFrameClippingBehavior)
stopTimecode_lastFrameClippingBehavior = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTimecode' {Maybe LastFrameClippingBehavior
lastFrameClippingBehavior :: Maybe LastFrameClippingBehavior
$sel:lastFrameClippingBehavior:StopTimecode' :: StopTimecode -> Maybe LastFrameClippingBehavior
lastFrameClippingBehavior} -> Maybe LastFrameClippingBehavior
lastFrameClippingBehavior) (\s :: StopTimecode
s@StopTimecode' {} Maybe LastFrameClippingBehavior
a -> StopTimecode
s {$sel:lastFrameClippingBehavior:StopTimecode' :: Maybe LastFrameClippingBehavior
lastFrameClippingBehavior = Maybe LastFrameClippingBehavior
a} :: StopTimecode)

-- | The timecode for the frame where you want to stop the clip. Optional; if
-- not specified, the clip continues to the end of the file. Enter the
-- timecode as HH:MM:SS:FF or HH:MM:SS;FF.
stopTimecode_timecode :: Lens.Lens' StopTimecode (Prelude.Maybe Prelude.Text)
stopTimecode_timecode :: Lens' StopTimecode (Maybe Text)
stopTimecode_timecode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTimecode' {Maybe Text
timecode :: Maybe Text
$sel:timecode:StopTimecode' :: StopTimecode -> Maybe Text
timecode} -> Maybe Text
timecode) (\s :: StopTimecode
s@StopTimecode' {} Maybe Text
a -> StopTimecode
s {$sel:timecode:StopTimecode' :: Maybe Text
timecode = Maybe Text
a} :: StopTimecode)

instance Data.FromJSON StopTimecode where
  parseJSON :: Value -> Parser StopTimecode
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StopTimecode"
      ( \Object
x ->
          Maybe LastFrameClippingBehavior -> Maybe Text -> StopTimecode
StopTimecode'
            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
"lastFrameClippingBehavior")
            forall (f :: * -> *) a b. Applicative f => 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 StopTimecode where
  hashWithSalt :: Int -> StopTimecode -> Int
hashWithSalt Int
_salt StopTimecode' {Maybe Text
Maybe LastFrameClippingBehavior
timecode :: Maybe Text
lastFrameClippingBehavior :: Maybe LastFrameClippingBehavior
$sel:timecode:StopTimecode' :: StopTimecode -> Maybe Text
$sel:lastFrameClippingBehavior:StopTimecode' :: StopTimecode -> Maybe LastFrameClippingBehavior
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LastFrameClippingBehavior
lastFrameClippingBehavior
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timecode

instance Prelude.NFData StopTimecode where
  rnf :: StopTimecode -> ()
rnf StopTimecode' {Maybe Text
Maybe LastFrameClippingBehavior
timecode :: Maybe Text
lastFrameClippingBehavior :: Maybe LastFrameClippingBehavior
$sel:timecode:StopTimecode' :: StopTimecode -> Maybe Text
$sel:lastFrameClippingBehavior:StopTimecode' :: StopTimecode -> Maybe LastFrameClippingBehavior
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LastFrameClippingBehavior
lastFrameClippingBehavior
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timecode

instance Data.ToJSON StopTimecode where
  toJSON :: StopTimecode -> Value
toJSON StopTimecode' {Maybe Text
Maybe LastFrameClippingBehavior
timecode :: Maybe Text
lastFrameClippingBehavior :: Maybe LastFrameClippingBehavior
$sel:timecode:StopTimecode' :: StopTimecode -> Maybe Text
$sel:lastFrameClippingBehavior:StopTimecode' :: StopTimecode -> Maybe LastFrameClippingBehavior
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"lastFrameClippingBehavior" 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 LastFrameClippingBehavior
lastFrameClippingBehavior,
            (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
          ]
      )