{-# 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.DolbyVisionLevel6Metadata
-- 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.DolbyVisionLevel6Metadata where

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

-- | Use these settings when you set DolbyVisionLevel6Mode to SPECIFY to
-- override the MaxCLL and MaxFALL values in your input with new values.
--
-- /See:/ 'newDolbyVisionLevel6Metadata' smart constructor.
data DolbyVisionLevel6Metadata = DolbyVisionLevel6Metadata'
  { -- | Maximum Frame-Average Light Level. Static HDR metadata that corresponds
    -- to the highest frame-average brightness in the entire stream. Measured
    -- in nits.
    DolbyVisionLevel6Metadata -> Maybe Natural
maxFall :: Prelude.Maybe Prelude.Natural,
    -- | Maximum Content Light Level. Static HDR metadata that corresponds to the
    -- brightest pixel in the entire stream. Measured in nits.
    DolbyVisionLevel6Metadata -> Maybe Natural
maxCll :: Prelude.Maybe Prelude.Natural
  }
  deriving (DolbyVisionLevel6Metadata -> DolbyVisionLevel6Metadata -> Bool
(DolbyVisionLevel6Metadata -> DolbyVisionLevel6Metadata -> Bool)
-> (DolbyVisionLevel6Metadata -> DolbyVisionLevel6Metadata -> Bool)
-> Eq DolbyVisionLevel6Metadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DolbyVisionLevel6Metadata -> DolbyVisionLevel6Metadata -> Bool
$c/= :: DolbyVisionLevel6Metadata -> DolbyVisionLevel6Metadata -> Bool
== :: DolbyVisionLevel6Metadata -> DolbyVisionLevel6Metadata -> Bool
$c== :: DolbyVisionLevel6Metadata -> DolbyVisionLevel6Metadata -> Bool
Prelude.Eq, ReadPrec [DolbyVisionLevel6Metadata]
ReadPrec DolbyVisionLevel6Metadata
Int -> ReadS DolbyVisionLevel6Metadata
ReadS [DolbyVisionLevel6Metadata]
(Int -> ReadS DolbyVisionLevel6Metadata)
-> ReadS [DolbyVisionLevel6Metadata]
-> ReadPrec DolbyVisionLevel6Metadata
-> ReadPrec [DolbyVisionLevel6Metadata]
-> Read DolbyVisionLevel6Metadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DolbyVisionLevel6Metadata]
$creadListPrec :: ReadPrec [DolbyVisionLevel6Metadata]
readPrec :: ReadPrec DolbyVisionLevel6Metadata
$creadPrec :: ReadPrec DolbyVisionLevel6Metadata
readList :: ReadS [DolbyVisionLevel6Metadata]
$creadList :: ReadS [DolbyVisionLevel6Metadata]
readsPrec :: Int -> ReadS DolbyVisionLevel6Metadata
$creadsPrec :: Int -> ReadS DolbyVisionLevel6Metadata
Prelude.Read, Int -> DolbyVisionLevel6Metadata -> ShowS
[DolbyVisionLevel6Metadata] -> ShowS
DolbyVisionLevel6Metadata -> String
(Int -> DolbyVisionLevel6Metadata -> ShowS)
-> (DolbyVisionLevel6Metadata -> String)
-> ([DolbyVisionLevel6Metadata] -> ShowS)
-> Show DolbyVisionLevel6Metadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DolbyVisionLevel6Metadata] -> ShowS
$cshowList :: [DolbyVisionLevel6Metadata] -> ShowS
show :: DolbyVisionLevel6Metadata -> String
$cshow :: DolbyVisionLevel6Metadata -> String
showsPrec :: Int -> DolbyVisionLevel6Metadata -> ShowS
$cshowsPrec :: Int -> DolbyVisionLevel6Metadata -> ShowS
Prelude.Show, (forall x.
 DolbyVisionLevel6Metadata -> Rep DolbyVisionLevel6Metadata x)
-> (forall x.
    Rep DolbyVisionLevel6Metadata x -> DolbyVisionLevel6Metadata)
-> Generic DolbyVisionLevel6Metadata
forall x.
Rep DolbyVisionLevel6Metadata x -> DolbyVisionLevel6Metadata
forall x.
DolbyVisionLevel6Metadata -> Rep DolbyVisionLevel6Metadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DolbyVisionLevel6Metadata x -> DolbyVisionLevel6Metadata
$cfrom :: forall x.
DolbyVisionLevel6Metadata -> Rep DolbyVisionLevel6Metadata x
Prelude.Generic)

-- |
-- Create a value of 'DolbyVisionLevel6Metadata' 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', 'dolbyVisionLevel6Metadata_maxFall' - Maximum Frame-Average Light Level. Static HDR metadata that corresponds
-- to the highest frame-average brightness in the entire stream. Measured
-- in nits.
--
-- 'maxCll', 'dolbyVisionLevel6Metadata_maxCll' - Maximum Content Light Level. Static HDR metadata that corresponds to the
-- brightest pixel in the entire stream. Measured in nits.
newDolbyVisionLevel6Metadata ::
  DolbyVisionLevel6Metadata
newDolbyVisionLevel6Metadata :: DolbyVisionLevel6Metadata
newDolbyVisionLevel6Metadata =
  DolbyVisionLevel6Metadata' :: Maybe Natural -> Maybe Natural -> DolbyVisionLevel6Metadata
DolbyVisionLevel6Metadata'
    { $sel:maxFall:DolbyVisionLevel6Metadata' :: Maybe Natural
maxFall =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:maxCll:DolbyVisionLevel6Metadata' :: Maybe Natural
maxCll = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Maximum Frame-Average Light Level. Static HDR metadata that corresponds
-- to the highest frame-average brightness in the entire stream. Measured
-- in nits.
dolbyVisionLevel6Metadata_maxFall :: Lens.Lens' DolbyVisionLevel6Metadata (Prelude.Maybe Prelude.Natural)
dolbyVisionLevel6Metadata_maxFall :: (Maybe Natural -> f (Maybe Natural))
-> DolbyVisionLevel6Metadata -> f DolbyVisionLevel6Metadata
dolbyVisionLevel6Metadata_maxFall = (DolbyVisionLevel6Metadata -> Maybe Natural)
-> (DolbyVisionLevel6Metadata
    -> Maybe Natural -> DolbyVisionLevel6Metadata)
-> Lens
     DolbyVisionLevel6Metadata
     DolbyVisionLevel6Metadata
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DolbyVisionLevel6Metadata' {Maybe Natural
maxFall :: Maybe Natural
$sel:maxFall:DolbyVisionLevel6Metadata' :: DolbyVisionLevel6Metadata -> Maybe Natural
maxFall} -> Maybe Natural
maxFall) (\s :: DolbyVisionLevel6Metadata
s@DolbyVisionLevel6Metadata' {} Maybe Natural
a -> DolbyVisionLevel6Metadata
s {$sel:maxFall:DolbyVisionLevel6Metadata' :: Maybe Natural
maxFall = Maybe Natural
a} :: DolbyVisionLevel6Metadata)

-- | Maximum Content Light Level. Static HDR metadata that corresponds to the
-- brightest pixel in the entire stream. Measured in nits.
dolbyVisionLevel6Metadata_maxCll :: Lens.Lens' DolbyVisionLevel6Metadata (Prelude.Maybe Prelude.Natural)
dolbyVisionLevel6Metadata_maxCll :: (Maybe Natural -> f (Maybe Natural))
-> DolbyVisionLevel6Metadata -> f DolbyVisionLevel6Metadata
dolbyVisionLevel6Metadata_maxCll = (DolbyVisionLevel6Metadata -> Maybe Natural)
-> (DolbyVisionLevel6Metadata
    -> Maybe Natural -> DolbyVisionLevel6Metadata)
-> Lens
     DolbyVisionLevel6Metadata
     DolbyVisionLevel6Metadata
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DolbyVisionLevel6Metadata' {Maybe Natural
maxCll :: Maybe Natural
$sel:maxCll:DolbyVisionLevel6Metadata' :: DolbyVisionLevel6Metadata -> Maybe Natural
maxCll} -> Maybe Natural
maxCll) (\s :: DolbyVisionLevel6Metadata
s@DolbyVisionLevel6Metadata' {} Maybe Natural
a -> DolbyVisionLevel6Metadata
s {$sel:maxCll:DolbyVisionLevel6Metadata' :: Maybe Natural
maxCll = Maybe Natural
a} :: DolbyVisionLevel6Metadata)

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

instance Prelude.NFData DolbyVisionLevel6Metadata

instance Core.ToJSON DolbyVisionLevel6Metadata where
  toJSON :: DolbyVisionLevel6Metadata -> Value
toJSON DolbyVisionLevel6Metadata' {Maybe Natural
maxCll :: Maybe Natural
maxFall :: Maybe Natural
$sel:maxCll:DolbyVisionLevel6Metadata' :: DolbyVisionLevel6Metadata -> Maybe Natural
$sel:maxFall:DolbyVisionLevel6Metadata' :: DolbyVisionLevel6Metadata -> 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
          ]
      )