{-# 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.MotionImageInsertionFramerate
-- 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.MotionImageInsertionFramerate 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

-- | For motion overlays that don\'t have a built-in frame rate, specify the
-- frame rate of the overlay in frames per second, as a fraction. For
-- example, specify 24 fps as 24\/1. The overlay frame rate doesn\'t need
-- to match the frame rate of the underlying video.
--
-- /See:/ 'newMotionImageInsertionFramerate' smart constructor.
data MotionImageInsertionFramerate = MotionImageInsertionFramerate'
  { -- | The bottom of the fraction that expresses your overlay frame rate. For
    -- example, if your frame rate is 24 fps, set this value to 1.
    MotionImageInsertionFramerate -> Maybe Natural
framerateDenominator :: Prelude.Maybe Prelude.Natural,
    -- | The top of the fraction that expresses your overlay frame rate. For
    -- example, if your frame rate is 24 fps, set this value to 24.
    MotionImageInsertionFramerate -> Maybe Natural
framerateNumerator :: Prelude.Maybe Prelude.Natural
  }
  deriving (MotionImageInsertionFramerate
-> MotionImageInsertionFramerate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MotionImageInsertionFramerate
-> MotionImageInsertionFramerate -> Bool
$c/= :: MotionImageInsertionFramerate
-> MotionImageInsertionFramerate -> Bool
== :: MotionImageInsertionFramerate
-> MotionImageInsertionFramerate -> Bool
$c== :: MotionImageInsertionFramerate
-> MotionImageInsertionFramerate -> Bool
Prelude.Eq, ReadPrec [MotionImageInsertionFramerate]
ReadPrec MotionImageInsertionFramerate
Int -> ReadS MotionImageInsertionFramerate
ReadS [MotionImageInsertionFramerate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MotionImageInsertionFramerate]
$creadListPrec :: ReadPrec [MotionImageInsertionFramerate]
readPrec :: ReadPrec MotionImageInsertionFramerate
$creadPrec :: ReadPrec MotionImageInsertionFramerate
readList :: ReadS [MotionImageInsertionFramerate]
$creadList :: ReadS [MotionImageInsertionFramerate]
readsPrec :: Int -> ReadS MotionImageInsertionFramerate
$creadsPrec :: Int -> ReadS MotionImageInsertionFramerate
Prelude.Read, Int -> MotionImageInsertionFramerate -> ShowS
[MotionImageInsertionFramerate] -> ShowS
MotionImageInsertionFramerate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MotionImageInsertionFramerate] -> ShowS
$cshowList :: [MotionImageInsertionFramerate] -> ShowS
show :: MotionImageInsertionFramerate -> String
$cshow :: MotionImageInsertionFramerate -> String
showsPrec :: Int -> MotionImageInsertionFramerate -> ShowS
$cshowsPrec :: Int -> MotionImageInsertionFramerate -> ShowS
Prelude.Show, forall x.
Rep MotionImageInsertionFramerate x
-> MotionImageInsertionFramerate
forall x.
MotionImageInsertionFramerate
-> Rep MotionImageInsertionFramerate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MotionImageInsertionFramerate x
-> MotionImageInsertionFramerate
$cfrom :: forall x.
MotionImageInsertionFramerate
-> Rep MotionImageInsertionFramerate x
Prelude.Generic)

-- |
-- Create a value of 'MotionImageInsertionFramerate' 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', 'motionImageInsertionFramerate_framerateDenominator' - The bottom of the fraction that expresses your overlay frame rate. For
-- example, if your frame rate is 24 fps, set this value to 1.
--
-- 'framerateNumerator', 'motionImageInsertionFramerate_framerateNumerator' - The top of the fraction that expresses your overlay frame rate. For
-- example, if your frame rate is 24 fps, set this value to 24.
newMotionImageInsertionFramerate ::
  MotionImageInsertionFramerate
newMotionImageInsertionFramerate :: MotionImageInsertionFramerate
newMotionImageInsertionFramerate =
  MotionImageInsertionFramerate'
    { $sel:framerateDenominator:MotionImageInsertionFramerate' :: Maybe Natural
framerateDenominator =
        forall a. Maybe a
Prelude.Nothing,
      $sel:framerateNumerator:MotionImageInsertionFramerate' :: Maybe Natural
framerateNumerator = forall a. Maybe a
Prelude.Nothing
    }

-- | The bottom of the fraction that expresses your overlay frame rate. For
-- example, if your frame rate is 24 fps, set this value to 1.
motionImageInsertionFramerate_framerateDenominator :: Lens.Lens' MotionImageInsertionFramerate (Prelude.Maybe Prelude.Natural)
motionImageInsertionFramerate_framerateDenominator :: Lens' MotionImageInsertionFramerate (Maybe Natural)
motionImageInsertionFramerate_framerateDenominator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MotionImageInsertionFramerate' {Maybe Natural
framerateDenominator :: Maybe Natural
$sel:framerateDenominator:MotionImageInsertionFramerate' :: MotionImageInsertionFramerate -> Maybe Natural
framerateDenominator} -> Maybe Natural
framerateDenominator) (\s :: MotionImageInsertionFramerate
s@MotionImageInsertionFramerate' {} Maybe Natural
a -> MotionImageInsertionFramerate
s {$sel:framerateDenominator:MotionImageInsertionFramerate' :: Maybe Natural
framerateDenominator = Maybe Natural
a} :: MotionImageInsertionFramerate)

-- | The top of the fraction that expresses your overlay frame rate. For
-- example, if your frame rate is 24 fps, set this value to 24.
motionImageInsertionFramerate_framerateNumerator :: Lens.Lens' MotionImageInsertionFramerate (Prelude.Maybe Prelude.Natural)
motionImageInsertionFramerate_framerateNumerator :: Lens' MotionImageInsertionFramerate (Maybe Natural)
motionImageInsertionFramerate_framerateNumerator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MotionImageInsertionFramerate' {Maybe Natural
framerateNumerator :: Maybe Natural
$sel:framerateNumerator:MotionImageInsertionFramerate' :: MotionImageInsertionFramerate -> Maybe Natural
framerateNumerator} -> Maybe Natural
framerateNumerator) (\s :: MotionImageInsertionFramerate
s@MotionImageInsertionFramerate' {} Maybe Natural
a -> MotionImageInsertionFramerate
s {$sel:framerateNumerator:MotionImageInsertionFramerate' :: Maybe Natural
framerateNumerator = Maybe Natural
a} :: MotionImageInsertionFramerate)

instance Data.FromJSON MotionImageInsertionFramerate where
  parseJSON :: Value -> Parser MotionImageInsertionFramerate
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MotionImageInsertionFramerate"
      ( \Object
x ->
          Maybe Natural -> Maybe Natural -> MotionImageInsertionFramerate
MotionImageInsertionFramerate'
            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
    MotionImageInsertionFramerate
  where
  hashWithSalt :: Int -> MotionImageInsertionFramerate -> Int
hashWithSalt Int
_salt MotionImageInsertionFramerate' {Maybe Natural
framerateNumerator :: Maybe Natural
framerateDenominator :: Maybe Natural
$sel:framerateNumerator:MotionImageInsertionFramerate' :: MotionImageInsertionFramerate -> Maybe Natural
$sel:framerateDenominator:MotionImageInsertionFramerate' :: MotionImageInsertionFramerate -> 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 MotionImageInsertionFramerate where
  rnf :: MotionImageInsertionFramerate -> ()
rnf MotionImageInsertionFramerate' {Maybe Natural
framerateNumerator :: Maybe Natural
framerateDenominator :: Maybe Natural
$sel:framerateNumerator:MotionImageInsertionFramerate' :: MotionImageInsertionFramerate -> Maybe Natural
$sel:framerateDenominator:MotionImageInsertionFramerate' :: MotionImageInsertionFramerate -> 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 MotionImageInsertionFramerate where
  toJSON :: MotionImageInsertionFramerate -> Value
toJSON MotionImageInsertionFramerate' {Maybe Natural
framerateNumerator :: Maybe Natural
framerateDenominator :: Maybe Natural
$sel:framerateNumerator:MotionImageInsertionFramerate' :: MotionImageInsertionFramerate -> Maybe Natural
$sel:framerateDenominator:MotionImageInsertionFramerate' :: MotionImageInsertionFramerate -> 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
          ]
      )