{-# 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 #-}
module Amazonka.MediaLive.Types.AudioLanguageSelection 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.AudioLanguageSelectionPolicy
import qualified Amazonka.Prelude as Prelude
data AudioLanguageSelection = AudioLanguageSelection'
{
AudioLanguageSelection -> Maybe AudioLanguageSelectionPolicy
languageSelectionPolicy :: Prelude.Maybe AudioLanguageSelectionPolicy,
AudioLanguageSelection -> Text
languageCode :: Prelude.Text
}
deriving (AudioLanguageSelection -> AudioLanguageSelection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioLanguageSelection -> AudioLanguageSelection -> Bool
$c/= :: AudioLanguageSelection -> AudioLanguageSelection -> Bool
== :: AudioLanguageSelection -> AudioLanguageSelection -> Bool
$c== :: AudioLanguageSelection -> AudioLanguageSelection -> Bool
Prelude.Eq, ReadPrec [AudioLanguageSelection]
ReadPrec AudioLanguageSelection
Int -> ReadS AudioLanguageSelection
ReadS [AudioLanguageSelection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioLanguageSelection]
$creadListPrec :: ReadPrec [AudioLanguageSelection]
readPrec :: ReadPrec AudioLanguageSelection
$creadPrec :: ReadPrec AudioLanguageSelection
readList :: ReadS [AudioLanguageSelection]
$creadList :: ReadS [AudioLanguageSelection]
readsPrec :: Int -> ReadS AudioLanguageSelection
$creadsPrec :: Int -> ReadS AudioLanguageSelection
Prelude.Read, Int -> AudioLanguageSelection -> ShowS
[AudioLanguageSelection] -> ShowS
AudioLanguageSelection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioLanguageSelection] -> ShowS
$cshowList :: [AudioLanguageSelection] -> ShowS
show :: AudioLanguageSelection -> String
$cshow :: AudioLanguageSelection -> String
showsPrec :: Int -> AudioLanguageSelection -> ShowS
$cshowsPrec :: Int -> AudioLanguageSelection -> ShowS
Prelude.Show, forall x. Rep AudioLanguageSelection x -> AudioLanguageSelection
forall x. AudioLanguageSelection -> Rep AudioLanguageSelection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioLanguageSelection x -> AudioLanguageSelection
$cfrom :: forall x. AudioLanguageSelection -> Rep AudioLanguageSelection x
Prelude.Generic)
newAudioLanguageSelection ::
Prelude.Text ->
AudioLanguageSelection
newAudioLanguageSelection :: Text -> AudioLanguageSelection
newAudioLanguageSelection Text
pLanguageCode_ =
AudioLanguageSelection'
{ $sel:languageSelectionPolicy:AudioLanguageSelection' :: Maybe AudioLanguageSelectionPolicy
languageSelectionPolicy =
forall a. Maybe a
Prelude.Nothing,
$sel:languageCode:AudioLanguageSelection' :: Text
languageCode = Text
pLanguageCode_
}
audioLanguageSelection_languageSelectionPolicy :: Lens.Lens' AudioLanguageSelection (Prelude.Maybe AudioLanguageSelectionPolicy)
audioLanguageSelection_languageSelectionPolicy :: Lens' AudioLanguageSelection (Maybe AudioLanguageSelectionPolicy)
audioLanguageSelection_languageSelectionPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioLanguageSelection' {Maybe AudioLanguageSelectionPolicy
languageSelectionPolicy :: Maybe AudioLanguageSelectionPolicy
$sel:languageSelectionPolicy:AudioLanguageSelection' :: AudioLanguageSelection -> Maybe AudioLanguageSelectionPolicy
languageSelectionPolicy} -> Maybe AudioLanguageSelectionPolicy
languageSelectionPolicy) (\s :: AudioLanguageSelection
s@AudioLanguageSelection' {} Maybe AudioLanguageSelectionPolicy
a -> AudioLanguageSelection
s {$sel:languageSelectionPolicy:AudioLanguageSelection' :: Maybe AudioLanguageSelectionPolicy
languageSelectionPolicy = Maybe AudioLanguageSelectionPolicy
a} :: AudioLanguageSelection)
audioLanguageSelection_languageCode :: Lens.Lens' AudioLanguageSelection Prelude.Text
audioLanguageSelection_languageCode :: Lens' AudioLanguageSelection Text
audioLanguageSelection_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioLanguageSelection' {Text
languageCode :: Text
$sel:languageCode:AudioLanguageSelection' :: AudioLanguageSelection -> Text
languageCode} -> Text
languageCode) (\s :: AudioLanguageSelection
s@AudioLanguageSelection' {} Text
a -> AudioLanguageSelection
s {$sel:languageCode:AudioLanguageSelection' :: Text
languageCode = Text
a} :: AudioLanguageSelection)
instance Data.FromJSON AudioLanguageSelection where
parseJSON :: Value -> Parser AudioLanguageSelection
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AudioLanguageSelection"
( \Object
x ->
Maybe AudioLanguageSelectionPolicy
-> Text -> AudioLanguageSelection
AudioLanguageSelection'
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
"languageSelectionPolicy")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"languageCode")
)
instance Prelude.Hashable AudioLanguageSelection where
hashWithSalt :: Int -> AudioLanguageSelection -> Int
hashWithSalt Int
_salt AudioLanguageSelection' {Maybe AudioLanguageSelectionPolicy
Text
languageCode :: Text
languageSelectionPolicy :: Maybe AudioLanguageSelectionPolicy
$sel:languageCode:AudioLanguageSelection' :: AudioLanguageSelection -> Text
$sel:languageSelectionPolicy:AudioLanguageSelection' :: AudioLanguageSelection -> Maybe AudioLanguageSelectionPolicy
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AudioLanguageSelectionPolicy
languageSelectionPolicy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
languageCode
instance Prelude.NFData AudioLanguageSelection where
rnf :: AudioLanguageSelection -> ()
rnf AudioLanguageSelection' {Maybe AudioLanguageSelectionPolicy
Text
languageCode :: Text
languageSelectionPolicy :: Maybe AudioLanguageSelectionPolicy
$sel:languageCode:AudioLanguageSelection' :: AudioLanguageSelection -> Text
$sel:languageSelectionPolicy:AudioLanguageSelection' :: AudioLanguageSelection -> Maybe AudioLanguageSelectionPolicy
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AudioLanguageSelectionPolicy
languageSelectionPolicy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
languageCode
instance Data.ToJSON AudioLanguageSelection where
toJSON :: AudioLanguageSelection -> Value
toJSON AudioLanguageSelection' {Maybe AudioLanguageSelectionPolicy
Text
languageCode :: Text
languageSelectionPolicy :: Maybe AudioLanguageSelectionPolicy
$sel:languageCode:AudioLanguageSelection' :: AudioLanguageSelection -> Text
$sel:languageSelectionPolicy:AudioLanguageSelection' :: AudioLanguageSelection -> Maybe AudioLanguageSelectionPolicy
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"languageSelectionPolicy" 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 AudioLanguageSelectionPolicy
languageSelectionPolicy,
forall a. a -> Maybe a
Prelude.Just (Key
"languageCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
languageCode)
]
)