{-# 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.CaptionDescription where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.CaptionDestinationSettings
import qualified Amazonka.Prelude as Prelude
data CaptionDescription = CaptionDescription'
{
CaptionDescription -> Maybe Text
languageCode :: Prelude.Maybe Prelude.Text,
CaptionDescription -> Maybe CaptionDestinationSettings
destinationSettings :: Prelude.Maybe CaptionDestinationSettings,
CaptionDescription -> Maybe Text
languageDescription :: Prelude.Maybe Prelude.Text,
CaptionDescription -> Text
captionSelectorName :: Prelude.Text,
CaptionDescription -> Text
name :: Prelude.Text
}
deriving (CaptionDescription -> CaptionDescription -> Bool
(CaptionDescription -> CaptionDescription -> Bool)
-> (CaptionDescription -> CaptionDescription -> Bool)
-> Eq CaptionDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaptionDescription -> CaptionDescription -> Bool
$c/= :: CaptionDescription -> CaptionDescription -> Bool
== :: CaptionDescription -> CaptionDescription -> Bool
$c== :: CaptionDescription -> CaptionDescription -> Bool
Prelude.Eq, ReadPrec [CaptionDescription]
ReadPrec CaptionDescription
Int -> ReadS CaptionDescription
ReadS [CaptionDescription]
(Int -> ReadS CaptionDescription)
-> ReadS [CaptionDescription]
-> ReadPrec CaptionDescription
-> ReadPrec [CaptionDescription]
-> Read CaptionDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaptionDescription]
$creadListPrec :: ReadPrec [CaptionDescription]
readPrec :: ReadPrec CaptionDescription
$creadPrec :: ReadPrec CaptionDescription
readList :: ReadS [CaptionDescription]
$creadList :: ReadS [CaptionDescription]
readsPrec :: Int -> ReadS CaptionDescription
$creadsPrec :: Int -> ReadS CaptionDescription
Prelude.Read, Int -> CaptionDescription -> ShowS
[CaptionDescription] -> ShowS
CaptionDescription -> String
(Int -> CaptionDescription -> ShowS)
-> (CaptionDescription -> String)
-> ([CaptionDescription] -> ShowS)
-> Show CaptionDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaptionDescription] -> ShowS
$cshowList :: [CaptionDescription] -> ShowS
show :: CaptionDescription -> String
$cshow :: CaptionDescription -> String
showsPrec :: Int -> CaptionDescription -> ShowS
$cshowsPrec :: Int -> CaptionDescription -> ShowS
Prelude.Show, (forall x. CaptionDescription -> Rep CaptionDescription x)
-> (forall x. Rep CaptionDescription x -> CaptionDescription)
-> Generic CaptionDescription
forall x. Rep CaptionDescription x -> CaptionDescription
forall x. CaptionDescription -> Rep CaptionDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CaptionDescription x -> CaptionDescription
$cfrom :: forall x. CaptionDescription -> Rep CaptionDescription x
Prelude.Generic)
newCaptionDescription ::
Prelude.Text ->
Prelude.Text ->
CaptionDescription
newCaptionDescription :: Text -> Text -> CaptionDescription
newCaptionDescription Text
pCaptionSelectorName_ Text
pName_ =
CaptionDescription' :: Maybe Text
-> Maybe CaptionDestinationSettings
-> Maybe Text
-> Text
-> Text
-> CaptionDescription
CaptionDescription'
{ $sel:languageCode:CaptionDescription' :: Maybe Text
languageCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:destinationSettings:CaptionDescription' :: Maybe CaptionDestinationSettings
destinationSettings = Maybe CaptionDestinationSettings
forall a. Maybe a
Prelude.Nothing,
$sel:languageDescription:CaptionDescription' :: Maybe Text
languageDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:captionSelectorName:CaptionDescription' :: Text
captionSelectorName = Text
pCaptionSelectorName_,
$sel:name:CaptionDescription' :: Text
name = Text
pName_
}
captionDescription_languageCode :: Lens.Lens' CaptionDescription (Prelude.Maybe Prelude.Text)
captionDescription_languageCode :: (Maybe Text -> f (Maybe Text))
-> CaptionDescription -> f CaptionDescription
captionDescription_languageCode = (CaptionDescription -> Maybe Text)
-> (CaptionDescription -> Maybe Text -> CaptionDescription)
-> Lens
CaptionDescription CaptionDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescription' {Maybe Text
languageCode :: Maybe Text
$sel:languageCode:CaptionDescription' :: CaptionDescription -> Maybe Text
languageCode} -> Maybe Text
languageCode) (\s :: CaptionDescription
s@CaptionDescription' {} Maybe Text
a -> CaptionDescription
s {$sel:languageCode:CaptionDescription' :: Maybe Text
languageCode = Maybe Text
a} :: CaptionDescription)
captionDescription_destinationSettings :: Lens.Lens' CaptionDescription (Prelude.Maybe CaptionDestinationSettings)
captionDescription_destinationSettings :: (Maybe CaptionDestinationSettings
-> f (Maybe CaptionDestinationSettings))
-> CaptionDescription -> f CaptionDescription
captionDescription_destinationSettings = (CaptionDescription -> Maybe CaptionDestinationSettings)
-> (CaptionDescription
-> Maybe CaptionDestinationSettings -> CaptionDescription)
-> Lens
CaptionDescription
CaptionDescription
(Maybe CaptionDestinationSettings)
(Maybe CaptionDestinationSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescription' {Maybe CaptionDestinationSettings
destinationSettings :: Maybe CaptionDestinationSettings
$sel:destinationSettings:CaptionDescription' :: CaptionDescription -> Maybe CaptionDestinationSettings
destinationSettings} -> Maybe CaptionDestinationSettings
destinationSettings) (\s :: CaptionDescription
s@CaptionDescription' {} Maybe CaptionDestinationSettings
a -> CaptionDescription
s {$sel:destinationSettings:CaptionDescription' :: Maybe CaptionDestinationSettings
destinationSettings = Maybe CaptionDestinationSettings
a} :: CaptionDescription)
captionDescription_languageDescription :: Lens.Lens' CaptionDescription (Prelude.Maybe Prelude.Text)
captionDescription_languageDescription :: (Maybe Text -> f (Maybe Text))
-> CaptionDescription -> f CaptionDescription
captionDescription_languageDescription = (CaptionDescription -> Maybe Text)
-> (CaptionDescription -> Maybe Text -> CaptionDescription)
-> Lens
CaptionDescription CaptionDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescription' {Maybe Text
languageDescription :: Maybe Text
$sel:languageDescription:CaptionDescription' :: CaptionDescription -> Maybe Text
languageDescription} -> Maybe Text
languageDescription) (\s :: CaptionDescription
s@CaptionDescription' {} Maybe Text
a -> CaptionDescription
s {$sel:languageDescription:CaptionDescription' :: Maybe Text
languageDescription = Maybe Text
a} :: CaptionDescription)
captionDescription_captionSelectorName :: Lens.Lens' CaptionDescription Prelude.Text
captionDescription_captionSelectorName :: (Text -> f Text) -> CaptionDescription -> f CaptionDescription
captionDescription_captionSelectorName = (CaptionDescription -> Text)
-> (CaptionDescription -> Text -> CaptionDescription)
-> Lens CaptionDescription CaptionDescription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescription' {Text
captionSelectorName :: Text
$sel:captionSelectorName:CaptionDescription' :: CaptionDescription -> Text
captionSelectorName} -> Text
captionSelectorName) (\s :: CaptionDescription
s@CaptionDescription' {} Text
a -> CaptionDescription
s {$sel:captionSelectorName:CaptionDescription' :: Text
captionSelectorName = Text
a} :: CaptionDescription)
captionDescription_name :: Lens.Lens' CaptionDescription Prelude.Text
captionDescription_name :: (Text -> f Text) -> CaptionDescription -> f CaptionDescription
captionDescription_name = (CaptionDescription -> Text)
-> (CaptionDescription -> Text -> CaptionDescription)
-> Lens CaptionDescription CaptionDescription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescription' {Text
name :: Text
$sel:name:CaptionDescription' :: CaptionDescription -> Text
name} -> Text
name) (\s :: CaptionDescription
s@CaptionDescription' {} Text
a -> CaptionDescription
s {$sel:name:CaptionDescription' :: Text
name = Text
a} :: CaptionDescription)
instance Core.FromJSON CaptionDescription where
parseJSON :: Value -> Parser CaptionDescription
parseJSON =
String
-> (Object -> Parser CaptionDescription)
-> Value
-> Parser CaptionDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CaptionDescription"
( \Object
x ->
Maybe Text
-> Maybe CaptionDestinationSettings
-> Maybe Text
-> Text
-> Text
-> CaptionDescription
CaptionDescription'
(Maybe Text
-> Maybe CaptionDestinationSettings
-> Maybe Text
-> Text
-> Text
-> CaptionDescription)
-> Parser (Maybe Text)
-> Parser
(Maybe CaptionDestinationSettings
-> Maybe Text -> Text -> Text -> CaptionDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"languageCode")
Parser
(Maybe CaptionDestinationSettings
-> Maybe Text -> Text -> Text -> CaptionDescription)
-> Parser (Maybe CaptionDestinationSettings)
-> Parser (Maybe Text -> Text -> Text -> CaptionDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CaptionDestinationSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"destinationSettings")
Parser (Maybe Text -> Text -> Text -> CaptionDescription)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> CaptionDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"languageDescription")
Parser (Text -> Text -> CaptionDescription)
-> Parser Text -> Parser (Text -> CaptionDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"captionSelectorName")
Parser (Text -> CaptionDescription)
-> Parser Text -> Parser CaptionDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
)
instance Prelude.Hashable CaptionDescription
instance Prelude.NFData CaptionDescription
instance Core.ToJSON CaptionDescription where
toJSON :: CaptionDescription -> Value
toJSON CaptionDescription' {Maybe Text
Maybe CaptionDestinationSettings
Text
name :: Text
captionSelectorName :: Text
languageDescription :: Maybe Text
destinationSettings :: Maybe CaptionDestinationSettings
languageCode :: Maybe Text
$sel:name:CaptionDescription' :: CaptionDescription -> Text
$sel:captionSelectorName:CaptionDescription' :: CaptionDescription -> Text
$sel:languageDescription:CaptionDescription' :: CaptionDescription -> Maybe Text
$sel:destinationSettings:CaptionDescription' :: CaptionDescription -> Maybe CaptionDestinationSettings
$sel:languageCode:CaptionDescription' :: CaptionDescription -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"languageCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
languageCode,
(Text
"destinationSettings" Text -> CaptionDestinationSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CaptionDestinationSettings -> Pair)
-> Maybe CaptionDestinationSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CaptionDestinationSettings
destinationSettings,
(Text
"languageDescription" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
languageDescription,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"captionSelectorName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
captionSelectorName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)