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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(StopTimecode -> StopTimecode -> Bool)
-> (StopTimecode -> StopTimecode -> Bool) -> Eq StopTimecode
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]
(Int -> ReadS StopTimecode)
-> ReadS [StopTimecode]
-> ReadPrec StopTimecode
-> ReadPrec [StopTimecode]
-> Read 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
(Int -> StopTimecode -> ShowS)
-> (StopTimecode -> String)
-> ([StopTimecode] -> ShowS)
-> Show StopTimecode
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. StopTimecode -> Rep StopTimecode x)
-> (forall x. Rep StopTimecode x -> StopTimecode)
-> Generic StopTimecode
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' :: Maybe LastFrameClippingBehavior -> Maybe Text -> StopTimecode
StopTimecode'
    { $sel:lastFrameClippingBehavior:StopTimecode' :: Maybe LastFrameClippingBehavior
lastFrameClippingBehavior =
        Maybe LastFrameClippingBehavior
forall a. Maybe a
Prelude.Nothing,
      $sel:timecode:StopTimecode' :: Maybe Text
timecode = Maybe Text
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 :: (Maybe LastFrameClippingBehavior
 -> f (Maybe LastFrameClippingBehavior))
-> StopTimecode -> f StopTimecode
stopTimecode_lastFrameClippingBehavior = (StopTimecode -> Maybe LastFrameClippingBehavior)
-> (StopTimecode
    -> Maybe LastFrameClippingBehavior -> StopTimecode)
-> Lens
     StopTimecode
     StopTimecode
     (Maybe LastFrameClippingBehavior)
     (Maybe 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 :: (Maybe Text -> f (Maybe Text)) -> StopTimecode -> f StopTimecode
stopTimecode_timecode = (StopTimecode -> Maybe Text)
-> (StopTimecode -> Maybe Text -> StopTimecode)
-> Lens StopTimecode StopTimecode (Maybe Text) (Maybe Text)
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 Core.FromJSON StopTimecode where
  parseJSON :: Value -> Parser StopTimecode
parseJSON =
    String
-> (Object -> Parser StopTimecode) -> Value -> Parser StopTimecode
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StopTimecode"
      ( \Object
x ->
          Maybe LastFrameClippingBehavior -> Maybe Text -> StopTimecode
StopTimecode'
            (Maybe LastFrameClippingBehavior -> Maybe Text -> StopTimecode)
-> Parser (Maybe LastFrameClippingBehavior)
-> Parser (Maybe Text -> StopTimecode)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LastFrameClippingBehavior)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastFrameClippingBehavior")
            Parser (Maybe Text -> StopTimecode)
-> Parser (Maybe Text) -> Parser StopTimecode
forall (f :: * -> *) a b. Applicative f => 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 StopTimecode

instance Prelude.NFData StopTimecode

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"lastFrameClippingBehavior" Text -> LastFrameClippingBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (LastFrameClippingBehavior -> Pair)
-> Maybe LastFrameClippingBehavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LastFrameClippingBehavior
lastFrameClippingBehavior,
            (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
          ]
      )