{-# 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.MediaConvert.Types.CaptionSourceFramerate
-- 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.MediaConvert.Types.CaptionSourceFramerate 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

-- | Ignore this setting unless your input captions format is SCC. To have
-- the service compensate for differing frame rates between your input
-- captions and input video, specify the frame rate of the captions file.
-- Specify this value as a fraction. When you work directly in your JSON
-- job specification, use the settings framerateNumerator and
-- framerateDenominator. For example, you might specify 24 \/ 1 for 24 fps,
-- 25 \/ 1 for 25 fps, 24000 \/ 1001 for 23.976 fps, or 30000 \/ 1001 for
-- 29.97 fps.
--
-- /See:/ 'newCaptionSourceFramerate' smart constructor.
data CaptionSourceFramerate = CaptionSourceFramerate'
  { -- | Specify the denominator of the fraction that represents the frame rate
    -- for the setting Caption source frame rate (CaptionSourceFramerate). Use
    -- this setting along with the setting Framerate numerator
    -- (framerateNumerator).
    CaptionSourceFramerate -> Maybe Natural
framerateDenominator :: Prelude.Maybe Prelude.Natural,
    -- | Specify the numerator of the fraction that represents the frame rate for
    -- the setting Caption source frame rate (CaptionSourceFramerate). Use this
    -- setting along with the setting Framerate denominator
    -- (framerateDenominator).
    CaptionSourceFramerate -> Maybe Natural
framerateNumerator :: Prelude.Maybe Prelude.Natural
  }
  deriving (CaptionSourceFramerate -> CaptionSourceFramerate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaptionSourceFramerate -> CaptionSourceFramerate -> Bool
$c/= :: CaptionSourceFramerate -> CaptionSourceFramerate -> Bool
== :: CaptionSourceFramerate -> CaptionSourceFramerate -> Bool
$c== :: CaptionSourceFramerate -> CaptionSourceFramerate -> Bool
Prelude.Eq, ReadPrec [CaptionSourceFramerate]
ReadPrec CaptionSourceFramerate
Int -> ReadS CaptionSourceFramerate
ReadS [CaptionSourceFramerate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaptionSourceFramerate]
$creadListPrec :: ReadPrec [CaptionSourceFramerate]
readPrec :: ReadPrec CaptionSourceFramerate
$creadPrec :: ReadPrec CaptionSourceFramerate
readList :: ReadS [CaptionSourceFramerate]
$creadList :: ReadS [CaptionSourceFramerate]
readsPrec :: Int -> ReadS CaptionSourceFramerate
$creadsPrec :: Int -> ReadS CaptionSourceFramerate
Prelude.Read, Int -> CaptionSourceFramerate -> ShowS
[CaptionSourceFramerate] -> ShowS
CaptionSourceFramerate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaptionSourceFramerate] -> ShowS
$cshowList :: [CaptionSourceFramerate] -> ShowS
show :: CaptionSourceFramerate -> String
$cshow :: CaptionSourceFramerate -> String
showsPrec :: Int -> CaptionSourceFramerate -> ShowS
$cshowsPrec :: Int -> CaptionSourceFramerate -> ShowS
Prelude.Show, forall x. Rep CaptionSourceFramerate x -> CaptionSourceFramerate
forall x. CaptionSourceFramerate -> Rep CaptionSourceFramerate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CaptionSourceFramerate x -> CaptionSourceFramerate
$cfrom :: forall x. CaptionSourceFramerate -> Rep CaptionSourceFramerate x
Prelude.Generic)

-- |
-- Create a value of 'CaptionSourceFramerate' 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:
--
-- 'framerateDenominator', 'captionSourceFramerate_framerateDenominator' - Specify the denominator of the fraction that represents the frame rate
-- for the setting Caption source frame rate (CaptionSourceFramerate). Use
-- this setting along with the setting Framerate numerator
-- (framerateNumerator).
--
-- 'framerateNumerator', 'captionSourceFramerate_framerateNumerator' - Specify the numerator of the fraction that represents the frame rate for
-- the setting Caption source frame rate (CaptionSourceFramerate). Use this
-- setting along with the setting Framerate denominator
-- (framerateDenominator).
newCaptionSourceFramerate ::
  CaptionSourceFramerate
newCaptionSourceFramerate :: CaptionSourceFramerate
newCaptionSourceFramerate =
  CaptionSourceFramerate'
    { $sel:framerateDenominator:CaptionSourceFramerate' :: Maybe Natural
framerateDenominator =
        forall a. Maybe a
Prelude.Nothing,
      $sel:framerateNumerator:CaptionSourceFramerate' :: Maybe Natural
framerateNumerator = forall a. Maybe a
Prelude.Nothing
    }

-- | Specify the denominator of the fraction that represents the frame rate
-- for the setting Caption source frame rate (CaptionSourceFramerate). Use
-- this setting along with the setting Framerate numerator
-- (framerateNumerator).
captionSourceFramerate_framerateDenominator :: Lens.Lens' CaptionSourceFramerate (Prelude.Maybe Prelude.Natural)
captionSourceFramerate_framerateDenominator :: Lens' CaptionSourceFramerate (Maybe Natural)
captionSourceFramerate_framerateDenominator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSourceFramerate' {Maybe Natural
framerateDenominator :: Maybe Natural
$sel:framerateDenominator:CaptionSourceFramerate' :: CaptionSourceFramerate -> Maybe Natural
framerateDenominator} -> Maybe Natural
framerateDenominator) (\s :: CaptionSourceFramerate
s@CaptionSourceFramerate' {} Maybe Natural
a -> CaptionSourceFramerate
s {$sel:framerateDenominator:CaptionSourceFramerate' :: Maybe Natural
framerateDenominator = Maybe Natural
a} :: CaptionSourceFramerate)

-- | Specify the numerator of the fraction that represents the frame rate for
-- the setting Caption source frame rate (CaptionSourceFramerate). Use this
-- setting along with the setting Framerate denominator
-- (framerateDenominator).
captionSourceFramerate_framerateNumerator :: Lens.Lens' CaptionSourceFramerate (Prelude.Maybe Prelude.Natural)
captionSourceFramerate_framerateNumerator :: Lens' CaptionSourceFramerate (Maybe Natural)
captionSourceFramerate_framerateNumerator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSourceFramerate' {Maybe Natural
framerateNumerator :: Maybe Natural
$sel:framerateNumerator:CaptionSourceFramerate' :: CaptionSourceFramerate -> Maybe Natural
framerateNumerator} -> Maybe Natural
framerateNumerator) (\s :: CaptionSourceFramerate
s@CaptionSourceFramerate' {} Maybe Natural
a -> CaptionSourceFramerate
s {$sel:framerateNumerator:CaptionSourceFramerate' :: Maybe Natural
framerateNumerator = Maybe Natural
a} :: CaptionSourceFramerate)

instance Data.FromJSON CaptionSourceFramerate where
  parseJSON :: Value -> Parser CaptionSourceFramerate
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CaptionSourceFramerate"
      ( \Object
x ->
          Maybe Natural -> Maybe Natural -> CaptionSourceFramerate
CaptionSourceFramerate'
            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
"framerateDenominator")
            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
"framerateNumerator")
      )

instance Prelude.Hashable CaptionSourceFramerate where
  hashWithSalt :: Int -> CaptionSourceFramerate -> Int
hashWithSalt Int
_salt CaptionSourceFramerate' {Maybe Natural
framerateNumerator :: Maybe Natural
framerateDenominator :: Maybe Natural
$sel:framerateNumerator:CaptionSourceFramerate' :: CaptionSourceFramerate -> Maybe Natural
$sel:framerateDenominator:CaptionSourceFramerate' :: CaptionSourceFramerate -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
framerateDenominator
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
framerateNumerator

instance Prelude.NFData CaptionSourceFramerate where
  rnf :: CaptionSourceFramerate -> ()
rnf CaptionSourceFramerate' {Maybe Natural
framerateNumerator :: Maybe Natural
framerateDenominator :: Maybe Natural
$sel:framerateNumerator:CaptionSourceFramerate' :: CaptionSourceFramerate -> Maybe Natural
$sel:framerateDenominator:CaptionSourceFramerate' :: CaptionSourceFramerate -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
framerateDenominator
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
framerateNumerator

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