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