{-# 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.ElasticTranscoder.Types.Captions where
import qualified Amazonka.Core as Core
import Amazonka.ElasticTranscoder.Types.CaptionFormat
import Amazonka.ElasticTranscoder.Types.CaptionSource
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Captions = Captions'
{
Captions -> Maybe Text
mergePolicy :: Prelude.Maybe Prelude.Text,
Captions -> Maybe [CaptionSource]
captionSources :: Prelude.Maybe [CaptionSource],
Captions -> Maybe [CaptionFormat]
captionFormats :: Prelude.Maybe [CaptionFormat]
}
deriving (Captions -> Captions -> Bool
(Captions -> Captions -> Bool)
-> (Captions -> Captions -> Bool) -> Eq Captions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Captions -> Captions -> Bool
$c/= :: Captions -> Captions -> Bool
== :: Captions -> Captions -> Bool
$c== :: Captions -> Captions -> Bool
Prelude.Eq, ReadPrec [Captions]
ReadPrec Captions
Int -> ReadS Captions
ReadS [Captions]
(Int -> ReadS Captions)
-> ReadS [Captions]
-> ReadPrec Captions
-> ReadPrec [Captions]
-> Read Captions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Captions]
$creadListPrec :: ReadPrec [Captions]
readPrec :: ReadPrec Captions
$creadPrec :: ReadPrec Captions
readList :: ReadS [Captions]
$creadList :: ReadS [Captions]
readsPrec :: Int -> ReadS Captions
$creadsPrec :: Int -> ReadS Captions
Prelude.Read, Int -> Captions -> ShowS
[Captions] -> ShowS
Captions -> String
(Int -> Captions -> ShowS)
-> (Captions -> String) -> ([Captions] -> ShowS) -> Show Captions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Captions] -> ShowS
$cshowList :: [Captions] -> ShowS
show :: Captions -> String
$cshow :: Captions -> String
showsPrec :: Int -> Captions -> ShowS
$cshowsPrec :: Int -> Captions -> ShowS
Prelude.Show, (forall x. Captions -> Rep Captions x)
-> (forall x. Rep Captions x -> Captions) -> Generic Captions
forall x. Rep Captions x -> Captions
forall x. Captions -> Rep Captions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Captions x -> Captions
$cfrom :: forall x. Captions -> Rep Captions x
Prelude.Generic)
newCaptions ::
Captions
newCaptions :: Captions
newCaptions =
Captions' :: Maybe Text
-> Maybe [CaptionSource] -> Maybe [CaptionFormat] -> Captions
Captions'
{ $sel:mergePolicy:Captions' :: Maybe Text
mergePolicy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:captionSources:Captions' :: Maybe [CaptionSource]
captionSources = Maybe [CaptionSource]
forall a. Maybe a
Prelude.Nothing,
$sel:captionFormats:Captions' :: Maybe [CaptionFormat]
captionFormats = Maybe [CaptionFormat]
forall a. Maybe a
Prelude.Nothing
}
captions_mergePolicy :: Lens.Lens' Captions (Prelude.Maybe Prelude.Text)
captions_mergePolicy :: (Maybe Text -> f (Maybe Text)) -> Captions -> f Captions
captions_mergePolicy = (Captions -> Maybe Text)
-> (Captions -> Maybe Text -> Captions)
-> Lens Captions Captions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Captions' {Maybe Text
mergePolicy :: Maybe Text
$sel:mergePolicy:Captions' :: Captions -> Maybe Text
mergePolicy} -> Maybe Text
mergePolicy) (\s :: Captions
s@Captions' {} Maybe Text
a -> Captions
s {$sel:mergePolicy:Captions' :: Maybe Text
mergePolicy = Maybe Text
a} :: Captions)
captions_captionSources :: Lens.Lens' Captions (Prelude.Maybe [CaptionSource])
captions_captionSources :: (Maybe [CaptionSource] -> f (Maybe [CaptionSource]))
-> Captions -> f Captions
captions_captionSources = (Captions -> Maybe [CaptionSource])
-> (Captions -> Maybe [CaptionSource] -> Captions)
-> Lens
Captions Captions (Maybe [CaptionSource]) (Maybe [CaptionSource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Captions' {Maybe [CaptionSource]
captionSources :: Maybe [CaptionSource]
$sel:captionSources:Captions' :: Captions -> Maybe [CaptionSource]
captionSources} -> Maybe [CaptionSource]
captionSources) (\s :: Captions
s@Captions' {} Maybe [CaptionSource]
a -> Captions
s {$sel:captionSources:Captions' :: Maybe [CaptionSource]
captionSources = Maybe [CaptionSource]
a} :: Captions) ((Maybe [CaptionSource] -> f (Maybe [CaptionSource]))
-> Captions -> f Captions)
-> ((Maybe [CaptionSource] -> f (Maybe [CaptionSource]))
-> Maybe [CaptionSource] -> f (Maybe [CaptionSource]))
-> (Maybe [CaptionSource] -> f (Maybe [CaptionSource]))
-> Captions
-> f Captions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[CaptionSource] [CaptionSource] [CaptionSource] [CaptionSource]
-> Iso
(Maybe [CaptionSource])
(Maybe [CaptionSource])
(Maybe [CaptionSource])
(Maybe [CaptionSource])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[CaptionSource] [CaptionSource] [CaptionSource] [CaptionSource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
captions_captionFormats :: Lens.Lens' Captions (Prelude.Maybe [CaptionFormat])
captions_captionFormats :: (Maybe [CaptionFormat] -> f (Maybe [CaptionFormat]))
-> Captions -> f Captions
captions_captionFormats = (Captions -> Maybe [CaptionFormat])
-> (Captions -> Maybe [CaptionFormat] -> Captions)
-> Lens
Captions Captions (Maybe [CaptionFormat]) (Maybe [CaptionFormat])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Captions' {Maybe [CaptionFormat]
captionFormats :: Maybe [CaptionFormat]
$sel:captionFormats:Captions' :: Captions -> Maybe [CaptionFormat]
captionFormats} -> Maybe [CaptionFormat]
captionFormats) (\s :: Captions
s@Captions' {} Maybe [CaptionFormat]
a -> Captions
s {$sel:captionFormats:Captions' :: Maybe [CaptionFormat]
captionFormats = Maybe [CaptionFormat]
a} :: Captions) ((Maybe [CaptionFormat] -> f (Maybe [CaptionFormat]))
-> Captions -> f Captions)
-> ((Maybe [CaptionFormat] -> f (Maybe [CaptionFormat]))
-> Maybe [CaptionFormat] -> f (Maybe [CaptionFormat]))
-> (Maybe [CaptionFormat] -> f (Maybe [CaptionFormat]))
-> Captions
-> f Captions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[CaptionFormat] [CaptionFormat] [CaptionFormat] [CaptionFormat]
-> Iso
(Maybe [CaptionFormat])
(Maybe [CaptionFormat])
(Maybe [CaptionFormat])
(Maybe [CaptionFormat])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[CaptionFormat] [CaptionFormat] [CaptionFormat] [CaptionFormat]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Captions where
parseJSON :: Value -> Parser Captions
parseJSON =
String -> (Object -> Parser Captions) -> Value -> Parser Captions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Captions"
( \Object
x ->
Maybe Text
-> Maybe [CaptionSource] -> Maybe [CaptionFormat] -> Captions
Captions'
(Maybe Text
-> Maybe [CaptionSource] -> Maybe [CaptionFormat] -> Captions)
-> Parser (Maybe Text)
-> Parser
(Maybe [CaptionSource] -> Maybe [CaptionFormat] -> Captions)
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
"MergePolicy")
Parser (Maybe [CaptionSource] -> Maybe [CaptionFormat] -> Captions)
-> Parser (Maybe [CaptionSource])
-> Parser (Maybe [CaptionFormat] -> Captions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [CaptionSource]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CaptionSources" Parser (Maybe (Maybe [CaptionSource]))
-> Maybe [CaptionSource] -> Parser (Maybe [CaptionSource])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [CaptionSource]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe [CaptionFormat] -> Captions)
-> Parser (Maybe [CaptionFormat]) -> Parser Captions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [CaptionFormat]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CaptionFormats"
Parser (Maybe (Maybe [CaptionFormat]))
-> Maybe [CaptionFormat] -> Parser (Maybe [CaptionFormat])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [CaptionFormat]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable Captions
instance Prelude.NFData Captions
instance Core.ToJSON Captions where
toJSON :: Captions -> Value
toJSON Captions' {Maybe [CaptionSource]
Maybe [CaptionFormat]
Maybe Text
captionFormats :: Maybe [CaptionFormat]
captionSources :: Maybe [CaptionSource]
mergePolicy :: Maybe Text
$sel:captionFormats:Captions' :: Captions -> Maybe [CaptionFormat]
$sel:captionSources:Captions' :: Captions -> Maybe [CaptionSource]
$sel:mergePolicy:Captions' :: Captions -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MergePolicy" 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
mergePolicy,
(Text
"CaptionSources" Text -> [CaptionSource] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([CaptionSource] -> Pair) -> Maybe [CaptionSource] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CaptionSource]
captionSources,
(Text
"CaptionFormats" Text -> [CaptionFormat] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([CaptionFormat] -> Pair) -> Maybe [CaptionFormat] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CaptionFormat]
captionFormats
]
)