{-# 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.MediaTailor.Types.AdBreak where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaTailor.Types.MessageType
import Amazonka.MediaTailor.Types.SlateSource
import Amazonka.MediaTailor.Types.SpliceInsertMessage
import qualified Amazonka.Prelude as Prelude
data AdBreak = AdBreak'
{
AdBreak -> Maybe SpliceInsertMessage
spliceInsertMessage :: Prelude.Maybe SpliceInsertMessage,
AdBreak -> Maybe MessageType
messageType :: Prelude.Maybe MessageType,
AdBreak -> Maybe SlateSource
slate :: Prelude.Maybe SlateSource,
AdBreak -> Maybe Integer
offsetMillis :: Prelude.Maybe Prelude.Integer
}
deriving (AdBreak -> AdBreak -> Bool
(AdBreak -> AdBreak -> Bool)
-> (AdBreak -> AdBreak -> Bool) -> Eq AdBreak
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdBreak -> AdBreak -> Bool
$c/= :: AdBreak -> AdBreak -> Bool
== :: AdBreak -> AdBreak -> Bool
$c== :: AdBreak -> AdBreak -> Bool
Prelude.Eq, ReadPrec [AdBreak]
ReadPrec AdBreak
Int -> ReadS AdBreak
ReadS [AdBreak]
(Int -> ReadS AdBreak)
-> ReadS [AdBreak]
-> ReadPrec AdBreak
-> ReadPrec [AdBreak]
-> Read AdBreak
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdBreak]
$creadListPrec :: ReadPrec [AdBreak]
readPrec :: ReadPrec AdBreak
$creadPrec :: ReadPrec AdBreak
readList :: ReadS [AdBreak]
$creadList :: ReadS [AdBreak]
readsPrec :: Int -> ReadS AdBreak
$creadsPrec :: Int -> ReadS AdBreak
Prelude.Read, Int -> AdBreak -> ShowS
[AdBreak] -> ShowS
AdBreak -> String
(Int -> AdBreak -> ShowS)
-> (AdBreak -> String) -> ([AdBreak] -> ShowS) -> Show AdBreak
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdBreak] -> ShowS
$cshowList :: [AdBreak] -> ShowS
show :: AdBreak -> String
$cshow :: AdBreak -> String
showsPrec :: Int -> AdBreak -> ShowS
$cshowsPrec :: Int -> AdBreak -> ShowS
Prelude.Show, (forall x. AdBreak -> Rep AdBreak x)
-> (forall x. Rep AdBreak x -> AdBreak) -> Generic AdBreak
forall x. Rep AdBreak x -> AdBreak
forall x. AdBreak -> Rep AdBreak x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdBreak x -> AdBreak
$cfrom :: forall x. AdBreak -> Rep AdBreak x
Prelude.Generic)
newAdBreak ::
AdBreak
newAdBreak :: AdBreak
newAdBreak =
AdBreak' :: Maybe SpliceInsertMessage
-> Maybe MessageType
-> Maybe SlateSource
-> Maybe Integer
-> AdBreak
AdBreak'
{ $sel:spliceInsertMessage:AdBreak' :: Maybe SpliceInsertMessage
spliceInsertMessage = Maybe SpliceInsertMessage
forall a. Maybe a
Prelude.Nothing,
$sel:messageType:AdBreak' :: Maybe MessageType
messageType = Maybe MessageType
forall a. Maybe a
Prelude.Nothing,
$sel:slate:AdBreak' :: Maybe SlateSource
slate = Maybe SlateSource
forall a. Maybe a
Prelude.Nothing,
$sel:offsetMillis:AdBreak' :: Maybe Integer
offsetMillis = Maybe Integer
forall a. Maybe a
Prelude.Nothing
}
adBreak_spliceInsertMessage :: Lens.Lens' AdBreak (Prelude.Maybe SpliceInsertMessage)
adBreak_spliceInsertMessage :: (Maybe SpliceInsertMessage -> f (Maybe SpliceInsertMessage))
-> AdBreak -> f AdBreak
adBreak_spliceInsertMessage = (AdBreak -> Maybe SpliceInsertMessage)
-> (AdBreak -> Maybe SpliceInsertMessage -> AdBreak)
-> Lens
AdBreak
AdBreak
(Maybe SpliceInsertMessage)
(Maybe SpliceInsertMessage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdBreak' {Maybe SpliceInsertMessage
spliceInsertMessage :: Maybe SpliceInsertMessage
$sel:spliceInsertMessage:AdBreak' :: AdBreak -> Maybe SpliceInsertMessage
spliceInsertMessage} -> Maybe SpliceInsertMessage
spliceInsertMessage) (\s :: AdBreak
s@AdBreak' {} Maybe SpliceInsertMessage
a -> AdBreak
s {$sel:spliceInsertMessage:AdBreak' :: Maybe SpliceInsertMessage
spliceInsertMessage = Maybe SpliceInsertMessage
a} :: AdBreak)
adBreak_messageType :: Lens.Lens' AdBreak (Prelude.Maybe MessageType)
adBreak_messageType :: (Maybe MessageType -> f (Maybe MessageType))
-> AdBreak -> f AdBreak
adBreak_messageType = (AdBreak -> Maybe MessageType)
-> (AdBreak -> Maybe MessageType -> AdBreak)
-> Lens AdBreak AdBreak (Maybe MessageType) (Maybe MessageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdBreak' {Maybe MessageType
messageType :: Maybe MessageType
$sel:messageType:AdBreak' :: AdBreak -> Maybe MessageType
messageType} -> Maybe MessageType
messageType) (\s :: AdBreak
s@AdBreak' {} Maybe MessageType
a -> AdBreak
s {$sel:messageType:AdBreak' :: Maybe MessageType
messageType = Maybe MessageType
a} :: AdBreak)
adBreak_slate :: Lens.Lens' AdBreak (Prelude.Maybe SlateSource)
adBreak_slate :: (Maybe SlateSource -> f (Maybe SlateSource))
-> AdBreak -> f AdBreak
adBreak_slate = (AdBreak -> Maybe SlateSource)
-> (AdBreak -> Maybe SlateSource -> AdBreak)
-> Lens AdBreak AdBreak (Maybe SlateSource) (Maybe SlateSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdBreak' {Maybe SlateSource
slate :: Maybe SlateSource
$sel:slate:AdBreak' :: AdBreak -> Maybe SlateSource
slate} -> Maybe SlateSource
slate) (\s :: AdBreak
s@AdBreak' {} Maybe SlateSource
a -> AdBreak
s {$sel:slate:AdBreak' :: Maybe SlateSource
slate = Maybe SlateSource
a} :: AdBreak)
adBreak_offsetMillis :: Lens.Lens' AdBreak (Prelude.Maybe Prelude.Integer)
adBreak_offsetMillis :: (Maybe Integer -> f (Maybe Integer)) -> AdBreak -> f AdBreak
adBreak_offsetMillis = (AdBreak -> Maybe Integer)
-> (AdBreak -> Maybe Integer -> AdBreak)
-> Lens AdBreak AdBreak (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdBreak' {Maybe Integer
offsetMillis :: Maybe Integer
$sel:offsetMillis:AdBreak' :: AdBreak -> Maybe Integer
offsetMillis} -> Maybe Integer
offsetMillis) (\s :: AdBreak
s@AdBreak' {} Maybe Integer
a -> AdBreak
s {$sel:offsetMillis:AdBreak' :: Maybe Integer
offsetMillis = Maybe Integer
a} :: AdBreak)
instance Core.FromJSON AdBreak where
parseJSON :: Value -> Parser AdBreak
parseJSON =
String -> (Object -> Parser AdBreak) -> Value -> Parser AdBreak
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AdBreak"
( \Object
x ->
Maybe SpliceInsertMessage
-> Maybe MessageType
-> Maybe SlateSource
-> Maybe Integer
-> AdBreak
AdBreak'
(Maybe SpliceInsertMessage
-> Maybe MessageType
-> Maybe SlateSource
-> Maybe Integer
-> AdBreak)
-> Parser (Maybe SpliceInsertMessage)
-> Parser
(Maybe MessageType
-> Maybe SlateSource -> Maybe Integer -> AdBreak)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SpliceInsertMessage)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SpliceInsertMessage")
Parser
(Maybe MessageType
-> Maybe SlateSource -> Maybe Integer -> AdBreak)
-> Parser (Maybe MessageType)
-> Parser (Maybe SlateSource -> Maybe Integer -> AdBreak)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MessageType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MessageType")
Parser (Maybe SlateSource -> Maybe Integer -> AdBreak)
-> Parser (Maybe SlateSource) -> Parser (Maybe Integer -> AdBreak)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SlateSource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Slate")
Parser (Maybe Integer -> AdBreak)
-> Parser (Maybe Integer) -> Parser AdBreak
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OffsetMillis")
)
instance Prelude.Hashable AdBreak
instance Prelude.NFData AdBreak
instance Core.ToJSON AdBreak where
toJSON :: AdBreak -> Value
toJSON AdBreak' {Maybe Integer
Maybe MessageType
Maybe SlateSource
Maybe SpliceInsertMessage
offsetMillis :: Maybe Integer
slate :: Maybe SlateSource
messageType :: Maybe MessageType
spliceInsertMessage :: Maybe SpliceInsertMessage
$sel:offsetMillis:AdBreak' :: AdBreak -> Maybe Integer
$sel:slate:AdBreak' :: AdBreak -> Maybe SlateSource
$sel:messageType:AdBreak' :: AdBreak -> Maybe MessageType
$sel:spliceInsertMessage:AdBreak' :: AdBreak -> Maybe SpliceInsertMessage
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SpliceInsertMessage" Text -> SpliceInsertMessage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(SpliceInsertMessage -> Pair)
-> Maybe SpliceInsertMessage -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SpliceInsertMessage
spliceInsertMessage,
(Text
"MessageType" Text -> MessageType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MessageType -> Pair) -> Maybe MessageType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MessageType
messageType,
(Text
"Slate" Text -> SlateSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SlateSource -> Pair) -> Maybe SlateSource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SlateSource
slate,
(Text
"OffsetMillis" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
offsetMillis
]
)