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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.ColorSpacePassthroughSettings
import Amazonka.MediaLive.Types.Rec601Settings
import Amazonka.MediaLive.Types.Rec709Settings
import qualified Amazonka.Prelude as Prelude

-- | H264 Color Space Settings
--
-- /See:/ 'newH264ColorSpaceSettings' smart constructor.
data H264ColorSpaceSettings = H264ColorSpaceSettings'
  { H264ColorSpaceSettings -> Maybe ColorSpacePassthroughSettings
colorSpacePassthroughSettings :: Prelude.Maybe ColorSpacePassthroughSettings,
    H264ColorSpaceSettings -> Maybe Rec601Settings
rec601Settings :: Prelude.Maybe Rec601Settings,
    H264ColorSpaceSettings -> Maybe Rec709Settings
rec709Settings :: Prelude.Maybe Rec709Settings
  }
  deriving (H264ColorSpaceSettings -> H264ColorSpaceSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: H264ColorSpaceSettings -> H264ColorSpaceSettings -> Bool
$c/= :: H264ColorSpaceSettings -> H264ColorSpaceSettings -> Bool
== :: H264ColorSpaceSettings -> H264ColorSpaceSettings -> Bool
$c== :: H264ColorSpaceSettings -> H264ColorSpaceSettings -> Bool
Prelude.Eq, ReadPrec [H264ColorSpaceSettings]
ReadPrec H264ColorSpaceSettings
Int -> ReadS H264ColorSpaceSettings
ReadS [H264ColorSpaceSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [H264ColorSpaceSettings]
$creadListPrec :: ReadPrec [H264ColorSpaceSettings]
readPrec :: ReadPrec H264ColorSpaceSettings
$creadPrec :: ReadPrec H264ColorSpaceSettings
readList :: ReadS [H264ColorSpaceSettings]
$creadList :: ReadS [H264ColorSpaceSettings]
readsPrec :: Int -> ReadS H264ColorSpaceSettings
$creadsPrec :: Int -> ReadS H264ColorSpaceSettings
Prelude.Read, Int -> H264ColorSpaceSettings -> ShowS
[H264ColorSpaceSettings] -> ShowS
H264ColorSpaceSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [H264ColorSpaceSettings] -> ShowS
$cshowList :: [H264ColorSpaceSettings] -> ShowS
show :: H264ColorSpaceSettings -> String
$cshow :: H264ColorSpaceSettings -> String
showsPrec :: Int -> H264ColorSpaceSettings -> ShowS
$cshowsPrec :: Int -> H264ColorSpaceSettings -> ShowS
Prelude.Show, forall x. Rep H264ColorSpaceSettings x -> H264ColorSpaceSettings
forall x. H264ColorSpaceSettings -> Rep H264ColorSpaceSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep H264ColorSpaceSettings x -> H264ColorSpaceSettings
$cfrom :: forall x. H264ColorSpaceSettings -> Rep H264ColorSpaceSettings x
Prelude.Generic)

-- |
-- Create a value of 'H264ColorSpaceSettings' 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:
--
-- 'colorSpacePassthroughSettings', 'h264ColorSpaceSettings_colorSpacePassthroughSettings' - Undocumented member.
--
-- 'rec601Settings', 'h264ColorSpaceSettings_rec601Settings' - Undocumented member.
--
-- 'rec709Settings', 'h264ColorSpaceSettings_rec709Settings' - Undocumented member.
newH264ColorSpaceSettings ::
  H264ColorSpaceSettings
newH264ColorSpaceSettings :: H264ColorSpaceSettings
newH264ColorSpaceSettings =
  H264ColorSpaceSettings'
    { $sel:colorSpacePassthroughSettings:H264ColorSpaceSettings' :: Maybe ColorSpacePassthroughSettings
colorSpacePassthroughSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:rec601Settings:H264ColorSpaceSettings' :: Maybe Rec601Settings
rec601Settings = forall a. Maybe a
Prelude.Nothing,
      $sel:rec709Settings:H264ColorSpaceSettings' :: Maybe Rec709Settings
rec709Settings = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
h264ColorSpaceSettings_colorSpacePassthroughSettings :: Lens.Lens' H264ColorSpaceSettings (Prelude.Maybe ColorSpacePassthroughSettings)
h264ColorSpaceSettings_colorSpacePassthroughSettings :: Lens' H264ColorSpaceSettings (Maybe ColorSpacePassthroughSettings)
h264ColorSpaceSettings_colorSpacePassthroughSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\H264ColorSpaceSettings' {Maybe ColorSpacePassthroughSettings
colorSpacePassthroughSettings :: Maybe ColorSpacePassthroughSettings
$sel:colorSpacePassthroughSettings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe ColorSpacePassthroughSettings
colorSpacePassthroughSettings} -> Maybe ColorSpacePassthroughSettings
colorSpacePassthroughSettings) (\s :: H264ColorSpaceSettings
s@H264ColorSpaceSettings' {} Maybe ColorSpacePassthroughSettings
a -> H264ColorSpaceSettings
s {$sel:colorSpacePassthroughSettings:H264ColorSpaceSettings' :: Maybe ColorSpacePassthroughSettings
colorSpacePassthroughSettings = Maybe ColorSpacePassthroughSettings
a} :: H264ColorSpaceSettings)

-- | Undocumented member.
h264ColorSpaceSettings_rec601Settings :: Lens.Lens' H264ColorSpaceSettings (Prelude.Maybe Rec601Settings)
h264ColorSpaceSettings_rec601Settings :: Lens' H264ColorSpaceSettings (Maybe Rec601Settings)
h264ColorSpaceSettings_rec601Settings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\H264ColorSpaceSettings' {Maybe Rec601Settings
rec601Settings :: Maybe Rec601Settings
$sel:rec601Settings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe Rec601Settings
rec601Settings} -> Maybe Rec601Settings
rec601Settings) (\s :: H264ColorSpaceSettings
s@H264ColorSpaceSettings' {} Maybe Rec601Settings
a -> H264ColorSpaceSettings
s {$sel:rec601Settings:H264ColorSpaceSettings' :: Maybe Rec601Settings
rec601Settings = Maybe Rec601Settings
a} :: H264ColorSpaceSettings)

-- | Undocumented member.
h264ColorSpaceSettings_rec709Settings :: Lens.Lens' H264ColorSpaceSettings (Prelude.Maybe Rec709Settings)
h264ColorSpaceSettings_rec709Settings :: Lens' H264ColorSpaceSettings (Maybe Rec709Settings)
h264ColorSpaceSettings_rec709Settings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\H264ColorSpaceSettings' {Maybe Rec709Settings
rec709Settings :: Maybe Rec709Settings
$sel:rec709Settings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe Rec709Settings
rec709Settings} -> Maybe Rec709Settings
rec709Settings) (\s :: H264ColorSpaceSettings
s@H264ColorSpaceSettings' {} Maybe Rec709Settings
a -> H264ColorSpaceSettings
s {$sel:rec709Settings:H264ColorSpaceSettings' :: Maybe Rec709Settings
rec709Settings = Maybe Rec709Settings
a} :: H264ColorSpaceSettings)

instance Data.FromJSON H264ColorSpaceSettings where
  parseJSON :: Value -> Parser H264ColorSpaceSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"H264ColorSpaceSettings"
      ( \Object
x ->
          Maybe ColorSpacePassthroughSettings
-> Maybe Rec601Settings
-> Maybe Rec709Settings
-> H264ColorSpaceSettings
H264ColorSpaceSettings'
            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
"colorSpacePassthroughSettings")
            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
"rec601Settings")
            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
"rec709Settings")
      )

instance Prelude.Hashable H264ColorSpaceSettings where
  hashWithSalt :: Int -> H264ColorSpaceSettings -> Int
hashWithSalt Int
_salt H264ColorSpaceSettings' {Maybe ColorSpacePassthroughSettings
Maybe Rec601Settings
Maybe Rec709Settings
rec709Settings :: Maybe Rec709Settings
rec601Settings :: Maybe Rec601Settings
colorSpacePassthroughSettings :: Maybe ColorSpacePassthroughSettings
$sel:rec709Settings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe Rec709Settings
$sel:rec601Settings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe Rec601Settings
$sel:colorSpacePassthroughSettings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe ColorSpacePassthroughSettings
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ColorSpacePassthroughSettings
colorSpacePassthroughSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Rec601Settings
rec601Settings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Rec709Settings
rec709Settings

instance Prelude.NFData H264ColorSpaceSettings where
  rnf :: H264ColorSpaceSettings -> ()
rnf H264ColorSpaceSettings' {Maybe ColorSpacePassthroughSettings
Maybe Rec601Settings
Maybe Rec709Settings
rec709Settings :: Maybe Rec709Settings
rec601Settings :: Maybe Rec601Settings
colorSpacePassthroughSettings :: Maybe ColorSpacePassthroughSettings
$sel:rec709Settings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe Rec709Settings
$sel:rec601Settings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe Rec601Settings
$sel:colorSpacePassthroughSettings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe ColorSpacePassthroughSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ColorSpacePassthroughSettings
colorSpacePassthroughSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Rec601Settings
rec601Settings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Rec709Settings
rec709Settings

instance Data.ToJSON H264ColorSpaceSettings where
  toJSON :: H264ColorSpaceSettings -> Value
toJSON H264ColorSpaceSettings' {Maybe ColorSpacePassthroughSettings
Maybe Rec601Settings
Maybe Rec709Settings
rec709Settings :: Maybe Rec709Settings
rec601Settings :: Maybe Rec601Settings
colorSpacePassthroughSettings :: Maybe ColorSpacePassthroughSettings
$sel:rec709Settings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe Rec709Settings
$sel:rec601Settings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe Rec601Settings
$sel:colorSpacePassthroughSettings:H264ColorSpaceSettings' :: H264ColorSpaceSettings -> Maybe ColorSpacePassthroughSettings
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"colorSpacePassthroughSettings" 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 ColorSpacePassthroughSettings
colorSpacePassthroughSettings,
            (Key
"rec601Settings" 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 Rec601Settings
rec601Settings,
            (Key
"rec709Settings" 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 Rec709Settings
rec709Settings
          ]
      )