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

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

instance
  Prelude.Hashable
    MotionImageInsertionFramerate

instance Prelude.NFData MotionImageInsertionFramerate

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