{-# 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.Transition where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaTailor.Types.RelativePosition
import qualified Amazonka.Prelude as Prelude
data Transition = Transition'
{
Transition -> Maybe Integer
scheduledStartTimeMillis :: Prelude.Maybe Prelude.Integer,
Transition -> Maybe Text
relativeProgram :: Prelude.Maybe Prelude.Text,
Transition -> Text
type' :: Prelude.Text,
Transition -> RelativePosition
relativePosition :: RelativePosition
}
deriving (Transition -> Transition -> Bool
(Transition -> Transition -> Bool)
-> (Transition -> Transition -> Bool) -> Eq Transition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Transition -> Transition -> Bool
$c/= :: Transition -> Transition -> Bool
== :: Transition -> Transition -> Bool
$c== :: Transition -> Transition -> Bool
Prelude.Eq, ReadPrec [Transition]
ReadPrec Transition
Int -> ReadS Transition
ReadS [Transition]
(Int -> ReadS Transition)
-> ReadS [Transition]
-> ReadPrec Transition
-> ReadPrec [Transition]
-> Read Transition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Transition]
$creadListPrec :: ReadPrec [Transition]
readPrec :: ReadPrec Transition
$creadPrec :: ReadPrec Transition
readList :: ReadS [Transition]
$creadList :: ReadS [Transition]
readsPrec :: Int -> ReadS Transition
$creadsPrec :: Int -> ReadS Transition
Prelude.Read, Int -> Transition -> ShowS
[Transition] -> ShowS
Transition -> String
(Int -> Transition -> ShowS)
-> (Transition -> String)
-> ([Transition] -> ShowS)
-> Show Transition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Transition] -> ShowS
$cshowList :: [Transition] -> ShowS
show :: Transition -> String
$cshow :: Transition -> String
showsPrec :: Int -> Transition -> ShowS
$cshowsPrec :: Int -> Transition -> ShowS
Prelude.Show, (forall x. Transition -> Rep Transition x)
-> (forall x. Rep Transition x -> Transition) -> Generic Transition
forall x. Rep Transition x -> Transition
forall x. Transition -> Rep Transition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Transition x -> Transition
$cfrom :: forall x. Transition -> Rep Transition x
Prelude.Generic)
newTransition ::
Prelude.Text ->
RelativePosition ->
Transition
newTransition :: Text -> RelativePosition -> Transition
newTransition Text
pType_ RelativePosition
pRelativePosition_ =
Transition' :: Maybe Integer
-> Maybe Text -> Text -> RelativePosition -> Transition
Transition'
{ $sel:scheduledStartTimeMillis:Transition' :: Maybe Integer
scheduledStartTimeMillis =
Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:relativeProgram:Transition' :: Maybe Text
relativeProgram = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':Transition' :: Text
type' = Text
pType_,
$sel:relativePosition:Transition' :: RelativePosition
relativePosition = RelativePosition
pRelativePosition_
}
transition_scheduledStartTimeMillis :: Lens.Lens' Transition (Prelude.Maybe Prelude.Integer)
transition_scheduledStartTimeMillis :: (Maybe Integer -> f (Maybe Integer)) -> Transition -> f Transition
transition_scheduledStartTimeMillis = (Transition -> Maybe Integer)
-> (Transition -> Maybe Integer -> Transition)
-> Lens Transition Transition (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transition' {Maybe Integer
scheduledStartTimeMillis :: Maybe Integer
$sel:scheduledStartTimeMillis:Transition' :: Transition -> Maybe Integer
scheduledStartTimeMillis} -> Maybe Integer
scheduledStartTimeMillis) (\s :: Transition
s@Transition' {} Maybe Integer
a -> Transition
s {$sel:scheduledStartTimeMillis:Transition' :: Maybe Integer
scheduledStartTimeMillis = Maybe Integer
a} :: Transition)
transition_relativeProgram :: Lens.Lens' Transition (Prelude.Maybe Prelude.Text)
transition_relativeProgram :: (Maybe Text -> f (Maybe Text)) -> Transition -> f Transition
transition_relativeProgram = (Transition -> Maybe Text)
-> (Transition -> Maybe Text -> Transition)
-> Lens Transition Transition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transition' {Maybe Text
relativeProgram :: Maybe Text
$sel:relativeProgram:Transition' :: Transition -> Maybe Text
relativeProgram} -> Maybe Text
relativeProgram) (\s :: Transition
s@Transition' {} Maybe Text
a -> Transition
s {$sel:relativeProgram:Transition' :: Maybe Text
relativeProgram = Maybe Text
a} :: Transition)
transition_type :: Lens.Lens' Transition Prelude.Text
transition_type :: (Text -> f Text) -> Transition -> f Transition
transition_type = (Transition -> Text)
-> (Transition -> Text -> Transition)
-> Lens Transition Transition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transition' {Text
type' :: Text
$sel:type':Transition' :: Transition -> Text
type'} -> Text
type') (\s :: Transition
s@Transition' {} Text
a -> Transition
s {$sel:type':Transition' :: Text
type' = Text
a} :: Transition)
transition_relativePosition :: Lens.Lens' Transition RelativePosition
transition_relativePosition :: (RelativePosition -> f RelativePosition)
-> Transition -> f Transition
transition_relativePosition = (Transition -> RelativePosition)
-> (Transition -> RelativePosition -> Transition)
-> Lens Transition Transition RelativePosition RelativePosition
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transition' {RelativePosition
relativePosition :: RelativePosition
$sel:relativePosition:Transition' :: Transition -> RelativePosition
relativePosition} -> RelativePosition
relativePosition) (\s :: Transition
s@Transition' {} RelativePosition
a -> Transition
s {$sel:relativePosition:Transition' :: RelativePosition
relativePosition = RelativePosition
a} :: Transition)
instance Prelude.Hashable Transition
instance Prelude.NFData Transition
instance Core.ToJSON Transition where
toJSON :: Transition -> Value
toJSON Transition' {Maybe Integer
Maybe Text
Text
RelativePosition
relativePosition :: RelativePosition
type' :: Text
relativeProgram :: Maybe Text
scheduledStartTimeMillis :: Maybe Integer
$sel:relativePosition:Transition' :: Transition -> RelativePosition
$sel:type':Transition' :: Transition -> Text
$sel:relativeProgram:Transition' :: Transition -> Maybe Text
$sel:scheduledStartTimeMillis:Transition' :: Transition -> Maybe Integer
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ScheduledStartTimeMillis" 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
scheduledStartTimeMillis,
(Text
"RelativeProgram" 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
relativeProgram,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
type'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"RelativePosition" Text -> RelativePosition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RelativePosition
relativePosition)
]
)