{-# 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.FrameCaptureSettings
-- 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.FrameCaptureSettings 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.FrameCaptureIntervalUnit
import Amazonka.MediaLive.Types.TimecodeBurninSettings
import qualified Amazonka.Prelude as Prelude

-- | Frame Capture Settings
--
-- /See:/ 'newFrameCaptureSettings' smart constructor.
data FrameCaptureSettings = FrameCaptureSettings'
  { -- | The frequency at which to capture frames for inclusion in the output.
    -- May be specified in either seconds or milliseconds, as specified by
    -- captureIntervalUnits.
    FrameCaptureSettings -> Maybe Natural
captureInterval :: Prelude.Maybe Prelude.Natural,
    -- | Unit for the frame capture interval.
    FrameCaptureSettings -> Maybe FrameCaptureIntervalUnit
captureIntervalUnits :: Prelude.Maybe FrameCaptureIntervalUnit,
    -- | Timecode burn-in settings
    FrameCaptureSettings -> Maybe TimecodeBurninSettings
timecodeBurninSettings :: Prelude.Maybe TimecodeBurninSettings
  }
  deriving (FrameCaptureSettings -> FrameCaptureSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FrameCaptureSettings -> FrameCaptureSettings -> Bool
$c/= :: FrameCaptureSettings -> FrameCaptureSettings -> Bool
== :: FrameCaptureSettings -> FrameCaptureSettings -> Bool
$c== :: FrameCaptureSettings -> FrameCaptureSettings -> Bool
Prelude.Eq, ReadPrec [FrameCaptureSettings]
ReadPrec FrameCaptureSettings
Int -> ReadS FrameCaptureSettings
ReadS [FrameCaptureSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FrameCaptureSettings]
$creadListPrec :: ReadPrec [FrameCaptureSettings]
readPrec :: ReadPrec FrameCaptureSettings
$creadPrec :: ReadPrec FrameCaptureSettings
readList :: ReadS [FrameCaptureSettings]
$creadList :: ReadS [FrameCaptureSettings]
readsPrec :: Int -> ReadS FrameCaptureSettings
$creadsPrec :: Int -> ReadS FrameCaptureSettings
Prelude.Read, Int -> FrameCaptureSettings -> ShowS
[FrameCaptureSettings] -> ShowS
FrameCaptureSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FrameCaptureSettings] -> ShowS
$cshowList :: [FrameCaptureSettings] -> ShowS
show :: FrameCaptureSettings -> String
$cshow :: FrameCaptureSettings -> String
showsPrec :: Int -> FrameCaptureSettings -> ShowS
$cshowsPrec :: Int -> FrameCaptureSettings -> ShowS
Prelude.Show, forall x. Rep FrameCaptureSettings x -> FrameCaptureSettings
forall x. FrameCaptureSettings -> Rep FrameCaptureSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FrameCaptureSettings x -> FrameCaptureSettings
$cfrom :: forall x. FrameCaptureSettings -> Rep FrameCaptureSettings x
Prelude.Generic)

-- |
-- Create a value of 'FrameCaptureSettings' 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:
--
-- 'captureInterval', 'frameCaptureSettings_captureInterval' - The frequency at which to capture frames for inclusion in the output.
-- May be specified in either seconds or milliseconds, as specified by
-- captureIntervalUnits.
--
-- 'captureIntervalUnits', 'frameCaptureSettings_captureIntervalUnits' - Unit for the frame capture interval.
--
-- 'timecodeBurninSettings', 'frameCaptureSettings_timecodeBurninSettings' - Timecode burn-in settings
newFrameCaptureSettings ::
  FrameCaptureSettings
newFrameCaptureSettings :: FrameCaptureSettings
newFrameCaptureSettings =
  FrameCaptureSettings'
    { $sel:captureInterval:FrameCaptureSettings' :: Maybe Natural
captureInterval =
        forall a. Maybe a
Prelude.Nothing,
      $sel:captureIntervalUnits:FrameCaptureSettings' :: Maybe FrameCaptureIntervalUnit
captureIntervalUnits = forall a. Maybe a
Prelude.Nothing,
      $sel:timecodeBurninSettings:FrameCaptureSettings' :: Maybe TimecodeBurninSettings
timecodeBurninSettings = forall a. Maybe a
Prelude.Nothing
    }

-- | The frequency at which to capture frames for inclusion in the output.
-- May be specified in either seconds or milliseconds, as specified by
-- captureIntervalUnits.
frameCaptureSettings_captureInterval :: Lens.Lens' FrameCaptureSettings (Prelude.Maybe Prelude.Natural)
frameCaptureSettings_captureInterval :: Lens' FrameCaptureSettings (Maybe Natural)
frameCaptureSettings_captureInterval = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameCaptureSettings' {Maybe Natural
captureInterval :: Maybe Natural
$sel:captureInterval:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe Natural
captureInterval} -> Maybe Natural
captureInterval) (\s :: FrameCaptureSettings
s@FrameCaptureSettings' {} Maybe Natural
a -> FrameCaptureSettings
s {$sel:captureInterval:FrameCaptureSettings' :: Maybe Natural
captureInterval = Maybe Natural
a} :: FrameCaptureSettings)

-- | Unit for the frame capture interval.
frameCaptureSettings_captureIntervalUnits :: Lens.Lens' FrameCaptureSettings (Prelude.Maybe FrameCaptureIntervalUnit)
frameCaptureSettings_captureIntervalUnits :: Lens' FrameCaptureSettings (Maybe FrameCaptureIntervalUnit)
frameCaptureSettings_captureIntervalUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameCaptureSettings' {Maybe FrameCaptureIntervalUnit
captureIntervalUnits :: Maybe FrameCaptureIntervalUnit
$sel:captureIntervalUnits:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe FrameCaptureIntervalUnit
captureIntervalUnits} -> Maybe FrameCaptureIntervalUnit
captureIntervalUnits) (\s :: FrameCaptureSettings
s@FrameCaptureSettings' {} Maybe FrameCaptureIntervalUnit
a -> FrameCaptureSettings
s {$sel:captureIntervalUnits:FrameCaptureSettings' :: Maybe FrameCaptureIntervalUnit
captureIntervalUnits = Maybe FrameCaptureIntervalUnit
a} :: FrameCaptureSettings)

-- | Timecode burn-in settings
frameCaptureSettings_timecodeBurninSettings :: Lens.Lens' FrameCaptureSettings (Prelude.Maybe TimecodeBurninSettings)
frameCaptureSettings_timecodeBurninSettings :: Lens' FrameCaptureSettings (Maybe TimecodeBurninSettings)
frameCaptureSettings_timecodeBurninSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameCaptureSettings' {Maybe TimecodeBurninSettings
timecodeBurninSettings :: Maybe TimecodeBurninSettings
$sel:timecodeBurninSettings:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe TimecodeBurninSettings
timecodeBurninSettings} -> Maybe TimecodeBurninSettings
timecodeBurninSettings) (\s :: FrameCaptureSettings
s@FrameCaptureSettings' {} Maybe TimecodeBurninSettings
a -> FrameCaptureSettings
s {$sel:timecodeBurninSettings:FrameCaptureSettings' :: Maybe TimecodeBurninSettings
timecodeBurninSettings = Maybe TimecodeBurninSettings
a} :: FrameCaptureSettings)

instance Data.FromJSON FrameCaptureSettings where
  parseJSON :: Value -> Parser FrameCaptureSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FrameCaptureSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe FrameCaptureIntervalUnit
-> Maybe TimecodeBurninSettings
-> FrameCaptureSettings
FrameCaptureSettings'
            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
"captureInterval")
            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
"captureIntervalUnits")
            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
"timecodeBurninSettings")
      )

instance Prelude.Hashable FrameCaptureSettings where
  hashWithSalt :: Int -> FrameCaptureSettings -> Int
hashWithSalt Int
_salt FrameCaptureSettings' {Maybe Natural
Maybe FrameCaptureIntervalUnit
Maybe TimecodeBurninSettings
timecodeBurninSettings :: Maybe TimecodeBurninSettings
captureIntervalUnits :: Maybe FrameCaptureIntervalUnit
captureInterval :: Maybe Natural
$sel:timecodeBurninSettings:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe TimecodeBurninSettings
$sel:captureIntervalUnits:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe FrameCaptureIntervalUnit
$sel:captureInterval:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
captureInterval
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FrameCaptureIntervalUnit
captureIntervalUnits
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimecodeBurninSettings
timecodeBurninSettings

instance Prelude.NFData FrameCaptureSettings where
  rnf :: FrameCaptureSettings -> ()
rnf FrameCaptureSettings' {Maybe Natural
Maybe FrameCaptureIntervalUnit
Maybe TimecodeBurninSettings
timecodeBurninSettings :: Maybe TimecodeBurninSettings
captureIntervalUnits :: Maybe FrameCaptureIntervalUnit
captureInterval :: Maybe Natural
$sel:timecodeBurninSettings:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe TimecodeBurninSettings
$sel:captureIntervalUnits:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe FrameCaptureIntervalUnit
$sel:captureInterval:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
captureInterval
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FrameCaptureIntervalUnit
captureIntervalUnits
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TimecodeBurninSettings
timecodeBurninSettings

instance Data.ToJSON FrameCaptureSettings where
  toJSON :: FrameCaptureSettings -> Value
toJSON FrameCaptureSettings' {Maybe Natural
Maybe FrameCaptureIntervalUnit
Maybe TimecodeBurninSettings
timecodeBurninSettings :: Maybe TimecodeBurninSettings
captureIntervalUnits :: Maybe FrameCaptureIntervalUnit
captureInterval :: Maybe Natural
$sel:timecodeBurninSettings:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe TimecodeBurninSettings
$sel:captureIntervalUnits:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe FrameCaptureIntervalUnit
$sel:captureInterval:FrameCaptureSettings' :: FrameCaptureSettings -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"captureInterval" 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 Natural
captureInterval,
            (Key
"captureIntervalUnits" 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 FrameCaptureIntervalUnit
captureIntervalUnits,
            (Key
"timecodeBurninSettings" 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 TimecodeBurninSettings
timecodeBurninSettings
          ]
      )