{-# 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.InputClippingSettings
-- 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.InputClippingSettings 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.InputTimecodeSource
import Amazonka.MediaLive.Types.StartTimecode
import Amazonka.MediaLive.Types.StopTimecode
import qualified Amazonka.Prelude as Prelude

-- | Settings to let you create a clip of the file input, in order to set up
-- the input to ingest only a portion of the file.
--
-- /See:/ 'newInputClippingSettings' smart constructor.
data InputClippingSettings = InputClippingSettings'
  { -- | Settings to identify the start of the clip.
    InputClippingSettings -> Maybe StartTimecode
startTimecode :: Prelude.Maybe StartTimecode,
    -- | Settings to identify the end of the clip.
    InputClippingSettings -> Maybe StopTimecode
stopTimecode :: Prelude.Maybe StopTimecode,
    -- | The source of the timecodes in the source being clipped.
    InputClippingSettings -> InputTimecodeSource
inputTimecodeSource :: InputTimecodeSource
  }
  deriving (InputClippingSettings -> InputClippingSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputClippingSettings -> InputClippingSettings -> Bool
$c/= :: InputClippingSettings -> InputClippingSettings -> Bool
== :: InputClippingSettings -> InputClippingSettings -> Bool
$c== :: InputClippingSettings -> InputClippingSettings -> Bool
Prelude.Eq, ReadPrec [InputClippingSettings]
ReadPrec InputClippingSettings
Int -> ReadS InputClippingSettings
ReadS [InputClippingSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputClippingSettings]
$creadListPrec :: ReadPrec [InputClippingSettings]
readPrec :: ReadPrec InputClippingSettings
$creadPrec :: ReadPrec InputClippingSettings
readList :: ReadS [InputClippingSettings]
$creadList :: ReadS [InputClippingSettings]
readsPrec :: Int -> ReadS InputClippingSettings
$creadsPrec :: Int -> ReadS InputClippingSettings
Prelude.Read, Int -> InputClippingSettings -> ShowS
[InputClippingSettings] -> ShowS
InputClippingSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputClippingSettings] -> ShowS
$cshowList :: [InputClippingSettings] -> ShowS
show :: InputClippingSettings -> String
$cshow :: InputClippingSettings -> String
showsPrec :: Int -> InputClippingSettings -> ShowS
$cshowsPrec :: Int -> InputClippingSettings -> ShowS
Prelude.Show, forall x. Rep InputClippingSettings x -> InputClippingSettings
forall x. InputClippingSettings -> Rep InputClippingSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputClippingSettings x -> InputClippingSettings
$cfrom :: forall x. InputClippingSettings -> Rep InputClippingSettings x
Prelude.Generic)

-- |
-- Create a value of 'InputClippingSettings' 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:
--
-- 'startTimecode', 'inputClippingSettings_startTimecode' - Settings to identify the start of the clip.
--
-- 'stopTimecode', 'inputClippingSettings_stopTimecode' - Settings to identify the end of the clip.
--
-- 'inputTimecodeSource', 'inputClippingSettings_inputTimecodeSource' - The source of the timecodes in the source being clipped.
newInputClippingSettings ::
  -- | 'inputTimecodeSource'
  InputTimecodeSource ->
  InputClippingSettings
newInputClippingSettings :: InputTimecodeSource -> InputClippingSettings
newInputClippingSettings InputTimecodeSource
pInputTimecodeSource_ =
  InputClippingSettings'
    { $sel:startTimecode:InputClippingSettings' :: Maybe StartTimecode
startTimecode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:stopTimecode:InputClippingSettings' :: Maybe StopTimecode
stopTimecode = forall a. Maybe a
Prelude.Nothing,
      $sel:inputTimecodeSource:InputClippingSettings' :: InputTimecodeSource
inputTimecodeSource = InputTimecodeSource
pInputTimecodeSource_
    }

-- | Settings to identify the start of the clip.
inputClippingSettings_startTimecode :: Lens.Lens' InputClippingSettings (Prelude.Maybe StartTimecode)
inputClippingSettings_startTimecode :: Lens' InputClippingSettings (Maybe StartTimecode)
inputClippingSettings_startTimecode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputClippingSettings' {Maybe StartTimecode
startTimecode :: Maybe StartTimecode
$sel:startTimecode:InputClippingSettings' :: InputClippingSettings -> Maybe StartTimecode
startTimecode} -> Maybe StartTimecode
startTimecode) (\s :: InputClippingSettings
s@InputClippingSettings' {} Maybe StartTimecode
a -> InputClippingSettings
s {$sel:startTimecode:InputClippingSettings' :: Maybe StartTimecode
startTimecode = Maybe StartTimecode
a} :: InputClippingSettings)

-- | Settings to identify the end of the clip.
inputClippingSettings_stopTimecode :: Lens.Lens' InputClippingSettings (Prelude.Maybe StopTimecode)
inputClippingSettings_stopTimecode :: Lens' InputClippingSettings (Maybe StopTimecode)
inputClippingSettings_stopTimecode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputClippingSettings' {Maybe StopTimecode
stopTimecode :: Maybe StopTimecode
$sel:stopTimecode:InputClippingSettings' :: InputClippingSettings -> Maybe StopTimecode
stopTimecode} -> Maybe StopTimecode
stopTimecode) (\s :: InputClippingSettings
s@InputClippingSettings' {} Maybe StopTimecode
a -> InputClippingSettings
s {$sel:stopTimecode:InputClippingSettings' :: Maybe StopTimecode
stopTimecode = Maybe StopTimecode
a} :: InputClippingSettings)

-- | The source of the timecodes in the source being clipped.
inputClippingSettings_inputTimecodeSource :: Lens.Lens' InputClippingSettings InputTimecodeSource
inputClippingSettings_inputTimecodeSource :: Lens' InputClippingSettings InputTimecodeSource
inputClippingSettings_inputTimecodeSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputClippingSettings' {InputTimecodeSource
inputTimecodeSource :: InputTimecodeSource
$sel:inputTimecodeSource:InputClippingSettings' :: InputClippingSettings -> InputTimecodeSource
inputTimecodeSource} -> InputTimecodeSource
inputTimecodeSource) (\s :: InputClippingSettings
s@InputClippingSettings' {} InputTimecodeSource
a -> InputClippingSettings
s {$sel:inputTimecodeSource:InputClippingSettings' :: InputTimecodeSource
inputTimecodeSource = InputTimecodeSource
a} :: InputClippingSettings)

instance Data.FromJSON InputClippingSettings where
  parseJSON :: Value -> Parser InputClippingSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputClippingSettings"
      ( \Object
x ->
          Maybe StartTimecode
-> Maybe StopTimecode
-> InputTimecodeSource
-> InputClippingSettings
InputClippingSettings'
            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
"startTimecode")
            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
"stopTimecode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"inputTimecodeSource")
      )

instance Prelude.Hashable InputClippingSettings where
  hashWithSalt :: Int -> InputClippingSettings -> Int
hashWithSalt Int
_salt InputClippingSettings' {Maybe StartTimecode
Maybe StopTimecode
InputTimecodeSource
inputTimecodeSource :: InputTimecodeSource
stopTimecode :: Maybe StopTimecode
startTimecode :: Maybe StartTimecode
$sel:inputTimecodeSource:InputClippingSettings' :: InputClippingSettings -> InputTimecodeSource
$sel:stopTimecode:InputClippingSettings' :: InputClippingSettings -> Maybe StopTimecode
$sel:startTimecode:InputClippingSettings' :: InputClippingSettings -> Maybe StartTimecode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StartTimecode
startTimecode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StopTimecode
stopTimecode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` InputTimecodeSource
inputTimecodeSource

instance Prelude.NFData InputClippingSettings where
  rnf :: InputClippingSettings -> ()
rnf InputClippingSettings' {Maybe StartTimecode
Maybe StopTimecode
InputTimecodeSource
inputTimecodeSource :: InputTimecodeSource
stopTimecode :: Maybe StopTimecode
startTimecode :: Maybe StartTimecode
$sel:inputTimecodeSource:InputClippingSettings' :: InputClippingSettings -> InputTimecodeSource
$sel:stopTimecode:InputClippingSettings' :: InputClippingSettings -> Maybe StopTimecode
$sel:startTimecode:InputClippingSettings' :: InputClippingSettings -> Maybe StartTimecode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe StartTimecode
startTimecode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StopTimecode
stopTimecode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf InputTimecodeSource
inputTimecodeSource

instance Data.ToJSON InputClippingSettings where
  toJSON :: InputClippingSettings -> Value
toJSON InputClippingSettings' {Maybe StartTimecode
Maybe StopTimecode
InputTimecodeSource
inputTimecodeSource :: InputTimecodeSource
stopTimecode :: Maybe StopTimecode
startTimecode :: Maybe StartTimecode
$sel:inputTimecodeSource:InputClippingSettings' :: InputClippingSettings -> InputTimecodeSource
$sel:stopTimecode:InputClippingSettings' :: InputClippingSettings -> Maybe StopTimecode
$sel:startTimecode:InputClippingSettings' :: InputClippingSettings -> Maybe StartTimecode
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"startTimecode" 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 StartTimecode
startTimecode,
            (Key
"stopTimecode" 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 StopTimecode
stopTimecode,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"inputTimecodeSource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= InputTimecodeSource
inputTimecodeSource)
          ]
      )