{-# 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.Hdr10Settings
-- 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.MediaLive.Types.Hdr10Settings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Hdr10 Settings
--
-- /See:/ 'newHdr10Settings' smart constructor.
data Hdr10Settings = Hdr10Settings'
  { -- | Maximum Frame Average Light Level An integer metadata value defining the
    -- maximum average light level, in nits, for any single frame within an
    -- encoded HDR video stream or file.
    Hdr10Settings -> Maybe Natural
maxFall :: Prelude.Maybe Prelude.Natural,
    -- | Maximum Content Light Level An integer metadata value defining the
    -- maximum light level, in nits, of any single pixel within an encoded HDR
    -- video stream or file.
    Hdr10Settings -> Maybe Natural
maxCll :: Prelude.Maybe Prelude.Natural
  }
  deriving (Hdr10Settings -> Hdr10Settings -> Bool
(Hdr10Settings -> Hdr10Settings -> Bool)
-> (Hdr10Settings -> Hdr10Settings -> Bool) -> Eq Hdr10Settings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Hdr10Settings -> Hdr10Settings -> Bool
$c/= :: Hdr10Settings -> Hdr10Settings -> Bool
== :: Hdr10Settings -> Hdr10Settings -> Bool
$c== :: Hdr10Settings -> Hdr10Settings -> Bool
Prelude.Eq, ReadPrec [Hdr10Settings]
ReadPrec Hdr10Settings
Int -> ReadS Hdr10Settings
ReadS [Hdr10Settings]
(Int -> ReadS Hdr10Settings)
-> ReadS [Hdr10Settings]
-> ReadPrec Hdr10Settings
-> ReadPrec [Hdr10Settings]
-> Read Hdr10Settings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Hdr10Settings]
$creadListPrec :: ReadPrec [Hdr10Settings]
readPrec :: ReadPrec Hdr10Settings
$creadPrec :: ReadPrec Hdr10Settings
readList :: ReadS [Hdr10Settings]
$creadList :: ReadS [Hdr10Settings]
readsPrec :: Int -> ReadS Hdr10Settings
$creadsPrec :: Int -> ReadS Hdr10Settings
Prelude.Read, Int -> Hdr10Settings -> ShowS
[Hdr10Settings] -> ShowS
Hdr10Settings -> String
(Int -> Hdr10Settings -> ShowS)
-> (Hdr10Settings -> String)
-> ([Hdr10Settings] -> ShowS)
-> Show Hdr10Settings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Hdr10Settings] -> ShowS
$cshowList :: [Hdr10Settings] -> ShowS
show :: Hdr10Settings -> String
$cshow :: Hdr10Settings -> String
showsPrec :: Int -> Hdr10Settings -> ShowS
$cshowsPrec :: Int -> Hdr10Settings -> ShowS
Prelude.Show, (forall x. Hdr10Settings -> Rep Hdr10Settings x)
-> (forall x. Rep Hdr10Settings x -> Hdr10Settings)
-> Generic Hdr10Settings
forall x. Rep Hdr10Settings x -> Hdr10Settings
forall x. Hdr10Settings -> Rep Hdr10Settings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Hdr10Settings x -> Hdr10Settings
$cfrom :: forall x. Hdr10Settings -> Rep Hdr10Settings x
Prelude.Generic)

-- |
-- Create a value of 'Hdr10Settings' 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:
--
-- 'maxFall', 'hdr10Settings_maxFall' - Maximum Frame Average Light Level An integer metadata value defining the
-- maximum average light level, in nits, for any single frame within an
-- encoded HDR video stream or file.
--
-- 'maxCll', 'hdr10Settings_maxCll' - Maximum Content Light Level An integer metadata value defining the
-- maximum light level, in nits, of any single pixel within an encoded HDR
-- video stream or file.
newHdr10Settings ::
  Hdr10Settings
newHdr10Settings :: Hdr10Settings
newHdr10Settings =
  Hdr10Settings' :: Maybe Natural -> Maybe Natural -> Hdr10Settings
Hdr10Settings'
    { $sel:maxFall:Hdr10Settings' :: Maybe Natural
maxFall = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:maxCll:Hdr10Settings' :: Maybe Natural
maxCll = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Maximum Frame Average Light Level An integer metadata value defining the
-- maximum average light level, in nits, for any single frame within an
-- encoded HDR video stream or file.
hdr10Settings_maxFall :: Lens.Lens' Hdr10Settings (Prelude.Maybe Prelude.Natural)
hdr10Settings_maxFall :: (Maybe Natural -> f (Maybe Natural))
-> Hdr10Settings -> f Hdr10Settings
hdr10Settings_maxFall = (Hdr10Settings -> Maybe Natural)
-> (Hdr10Settings -> Maybe Natural -> Hdr10Settings)
-> Lens Hdr10Settings Hdr10Settings (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Hdr10Settings' {Maybe Natural
maxFall :: Maybe Natural
$sel:maxFall:Hdr10Settings' :: Hdr10Settings -> Maybe Natural
maxFall} -> Maybe Natural
maxFall) (\s :: Hdr10Settings
s@Hdr10Settings' {} Maybe Natural
a -> Hdr10Settings
s {$sel:maxFall:Hdr10Settings' :: Maybe Natural
maxFall = Maybe Natural
a} :: Hdr10Settings)

-- | Maximum Content Light Level An integer metadata value defining the
-- maximum light level, in nits, of any single pixel within an encoded HDR
-- video stream or file.
hdr10Settings_maxCll :: Lens.Lens' Hdr10Settings (Prelude.Maybe Prelude.Natural)
hdr10Settings_maxCll :: (Maybe Natural -> f (Maybe Natural))
-> Hdr10Settings -> f Hdr10Settings
hdr10Settings_maxCll = (Hdr10Settings -> Maybe Natural)
-> (Hdr10Settings -> Maybe Natural -> Hdr10Settings)
-> Lens Hdr10Settings Hdr10Settings (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Hdr10Settings' {Maybe Natural
maxCll :: Maybe Natural
$sel:maxCll:Hdr10Settings' :: Hdr10Settings -> Maybe Natural
maxCll} -> Maybe Natural
maxCll) (\s :: Hdr10Settings
s@Hdr10Settings' {} Maybe Natural
a -> Hdr10Settings
s {$sel:maxCll:Hdr10Settings' :: Maybe Natural
maxCll = Maybe Natural
a} :: Hdr10Settings)

instance Core.FromJSON Hdr10Settings where
  parseJSON :: Value -> Parser Hdr10Settings
parseJSON =
    String
-> (Object -> Parser Hdr10Settings)
-> Value
-> Parser Hdr10Settings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Hdr10Settings"
      ( \Object
x ->
          Maybe Natural -> Maybe Natural -> Hdr10Settings
Hdr10Settings'
            (Maybe Natural -> Maybe Natural -> Hdr10Settings)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Hdr10Settings)
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
"maxFall")
            Parser (Maybe Natural -> Hdr10Settings)
-> Parser (Maybe Natural) -> Parser Hdr10Settings
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
"maxCll")
      )

instance Prelude.Hashable Hdr10Settings

instance Prelude.NFData Hdr10Settings

instance Core.ToJSON Hdr10Settings where
  toJSON :: Hdr10Settings -> Value
toJSON Hdr10Settings' {Maybe Natural
maxCll :: Maybe Natural
maxFall :: Maybe Natural
$sel:maxCll:Hdr10Settings' :: Hdr10Settings -> Maybe Natural
$sel:maxFall:Hdr10Settings' :: Hdr10Settings -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"maxFall" 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
maxFall,
            (Text
"maxCll" 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
maxCll
          ]
      )