{-# 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.Pinpoint.Types.PushMessageActivity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.JourneyPushMessage
import qualified Amazonka.Prelude as Prelude
data PushMessageActivity = PushMessageActivity'
{
PushMessageActivity -> Maybe Text
templateName :: Prelude.Maybe Prelude.Text,
PushMessageActivity -> Maybe Text
templateVersion :: Prelude.Maybe Prelude.Text,
PushMessageActivity -> Maybe Text
nextActivity :: Prelude.Maybe Prelude.Text,
PushMessageActivity -> Maybe JourneyPushMessage
messageConfig :: Prelude.Maybe JourneyPushMessage
}
deriving (PushMessageActivity -> PushMessageActivity -> Bool
(PushMessageActivity -> PushMessageActivity -> Bool)
-> (PushMessageActivity -> PushMessageActivity -> Bool)
-> Eq PushMessageActivity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PushMessageActivity -> PushMessageActivity -> Bool
$c/= :: PushMessageActivity -> PushMessageActivity -> Bool
== :: PushMessageActivity -> PushMessageActivity -> Bool
$c== :: PushMessageActivity -> PushMessageActivity -> Bool
Prelude.Eq, ReadPrec [PushMessageActivity]
ReadPrec PushMessageActivity
Int -> ReadS PushMessageActivity
ReadS [PushMessageActivity]
(Int -> ReadS PushMessageActivity)
-> ReadS [PushMessageActivity]
-> ReadPrec PushMessageActivity
-> ReadPrec [PushMessageActivity]
-> Read PushMessageActivity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PushMessageActivity]
$creadListPrec :: ReadPrec [PushMessageActivity]
readPrec :: ReadPrec PushMessageActivity
$creadPrec :: ReadPrec PushMessageActivity
readList :: ReadS [PushMessageActivity]
$creadList :: ReadS [PushMessageActivity]
readsPrec :: Int -> ReadS PushMessageActivity
$creadsPrec :: Int -> ReadS PushMessageActivity
Prelude.Read, Int -> PushMessageActivity -> ShowS
[PushMessageActivity] -> ShowS
PushMessageActivity -> String
(Int -> PushMessageActivity -> ShowS)
-> (PushMessageActivity -> String)
-> ([PushMessageActivity] -> ShowS)
-> Show PushMessageActivity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PushMessageActivity] -> ShowS
$cshowList :: [PushMessageActivity] -> ShowS
show :: PushMessageActivity -> String
$cshow :: PushMessageActivity -> String
showsPrec :: Int -> PushMessageActivity -> ShowS
$cshowsPrec :: Int -> PushMessageActivity -> ShowS
Prelude.Show, (forall x. PushMessageActivity -> Rep PushMessageActivity x)
-> (forall x. Rep PushMessageActivity x -> PushMessageActivity)
-> Generic PushMessageActivity
forall x. Rep PushMessageActivity x -> PushMessageActivity
forall x. PushMessageActivity -> Rep PushMessageActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PushMessageActivity x -> PushMessageActivity
$cfrom :: forall x. PushMessageActivity -> Rep PushMessageActivity x
Prelude.Generic)
newPushMessageActivity ::
PushMessageActivity
newPushMessageActivity :: PushMessageActivity
newPushMessageActivity =
PushMessageActivity' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JourneyPushMessage
-> PushMessageActivity
PushMessageActivity'
{ $sel:templateName:PushMessageActivity' :: Maybe Text
templateName =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:templateVersion:PushMessageActivity' :: Maybe Text
templateVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:nextActivity:PushMessageActivity' :: Maybe Text
nextActivity = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:messageConfig:PushMessageActivity' :: Maybe JourneyPushMessage
messageConfig = Maybe JourneyPushMessage
forall a. Maybe a
Prelude.Nothing
}
pushMessageActivity_templateName :: Lens.Lens' PushMessageActivity (Prelude.Maybe Prelude.Text)
pushMessageActivity_templateName :: (Maybe Text -> f (Maybe Text))
-> PushMessageActivity -> f PushMessageActivity
pushMessageActivity_templateName = (PushMessageActivity -> Maybe Text)
-> (PushMessageActivity -> Maybe Text -> PushMessageActivity)
-> Lens
PushMessageActivity PushMessageActivity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PushMessageActivity' {Maybe Text
templateName :: Maybe Text
$sel:templateName:PushMessageActivity' :: PushMessageActivity -> Maybe Text
templateName} -> Maybe Text
templateName) (\s :: PushMessageActivity
s@PushMessageActivity' {} Maybe Text
a -> PushMessageActivity
s {$sel:templateName:PushMessageActivity' :: Maybe Text
templateName = Maybe Text
a} :: PushMessageActivity)
pushMessageActivity_templateVersion :: Lens.Lens' PushMessageActivity (Prelude.Maybe Prelude.Text)
pushMessageActivity_templateVersion :: (Maybe Text -> f (Maybe Text))
-> PushMessageActivity -> f PushMessageActivity
pushMessageActivity_templateVersion = (PushMessageActivity -> Maybe Text)
-> (PushMessageActivity -> Maybe Text -> PushMessageActivity)
-> Lens
PushMessageActivity PushMessageActivity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PushMessageActivity' {Maybe Text
templateVersion :: Maybe Text
$sel:templateVersion:PushMessageActivity' :: PushMessageActivity -> Maybe Text
templateVersion} -> Maybe Text
templateVersion) (\s :: PushMessageActivity
s@PushMessageActivity' {} Maybe Text
a -> PushMessageActivity
s {$sel:templateVersion:PushMessageActivity' :: Maybe Text
templateVersion = Maybe Text
a} :: PushMessageActivity)
pushMessageActivity_nextActivity :: Lens.Lens' PushMessageActivity (Prelude.Maybe Prelude.Text)
pushMessageActivity_nextActivity :: (Maybe Text -> f (Maybe Text))
-> PushMessageActivity -> f PushMessageActivity
pushMessageActivity_nextActivity = (PushMessageActivity -> Maybe Text)
-> (PushMessageActivity -> Maybe Text -> PushMessageActivity)
-> Lens
PushMessageActivity PushMessageActivity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PushMessageActivity' {Maybe Text
nextActivity :: Maybe Text
$sel:nextActivity:PushMessageActivity' :: PushMessageActivity -> Maybe Text
nextActivity} -> Maybe Text
nextActivity) (\s :: PushMessageActivity
s@PushMessageActivity' {} Maybe Text
a -> PushMessageActivity
s {$sel:nextActivity:PushMessageActivity' :: Maybe Text
nextActivity = Maybe Text
a} :: PushMessageActivity)
pushMessageActivity_messageConfig :: Lens.Lens' PushMessageActivity (Prelude.Maybe JourneyPushMessage)
pushMessageActivity_messageConfig :: (Maybe JourneyPushMessage -> f (Maybe JourneyPushMessage))
-> PushMessageActivity -> f PushMessageActivity
pushMessageActivity_messageConfig = (PushMessageActivity -> Maybe JourneyPushMessage)
-> (PushMessageActivity
-> Maybe JourneyPushMessage -> PushMessageActivity)
-> Lens
PushMessageActivity
PushMessageActivity
(Maybe JourneyPushMessage)
(Maybe JourneyPushMessage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PushMessageActivity' {Maybe JourneyPushMessage
messageConfig :: Maybe JourneyPushMessage
$sel:messageConfig:PushMessageActivity' :: PushMessageActivity -> Maybe JourneyPushMessage
messageConfig} -> Maybe JourneyPushMessage
messageConfig) (\s :: PushMessageActivity
s@PushMessageActivity' {} Maybe JourneyPushMessage
a -> PushMessageActivity
s {$sel:messageConfig:PushMessageActivity' :: Maybe JourneyPushMessage
messageConfig = Maybe JourneyPushMessage
a} :: PushMessageActivity)
instance Core.FromJSON PushMessageActivity where
parseJSON :: Value -> Parser PushMessageActivity
parseJSON =
String
-> (Object -> Parser PushMessageActivity)
-> Value
-> Parser PushMessageActivity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PushMessageActivity"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JourneyPushMessage
-> PushMessageActivity
PushMessageActivity'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JourneyPushMessage
-> PushMessageActivity)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text -> Maybe JourneyPushMessage -> PushMessageActivity)
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
"TemplateName")
Parser
(Maybe Text
-> Maybe Text -> Maybe JourneyPushMessage -> PushMessageActivity)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe JourneyPushMessage -> PushMessageActivity)
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
"TemplateVersion")
Parser
(Maybe Text -> Maybe JourneyPushMessage -> PushMessageActivity)
-> Parser (Maybe Text)
-> Parser (Maybe JourneyPushMessage -> PushMessageActivity)
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
"NextActivity")
Parser (Maybe JourneyPushMessage -> PushMessageActivity)
-> Parser (Maybe JourneyPushMessage) -> Parser PushMessageActivity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe JourneyPushMessage)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MessageConfig")
)
instance Prelude.Hashable PushMessageActivity
instance Prelude.NFData PushMessageActivity
instance Core.ToJSON PushMessageActivity where
toJSON :: PushMessageActivity -> Value
toJSON PushMessageActivity' {Maybe Text
Maybe JourneyPushMessage
messageConfig :: Maybe JourneyPushMessage
nextActivity :: Maybe Text
templateVersion :: Maybe Text
templateName :: Maybe Text
$sel:messageConfig:PushMessageActivity' :: PushMessageActivity -> Maybe JourneyPushMessage
$sel:nextActivity:PushMessageActivity' :: PushMessageActivity -> Maybe Text
$sel:templateVersion:PushMessageActivity' :: PushMessageActivity -> Maybe Text
$sel:templateName:PushMessageActivity' :: PushMessageActivity -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"TemplateName" 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
templateName,
(Text
"TemplateVersion" 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
templateVersion,
(Text
"NextActivity" 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
nextActivity,
(Text
"MessageConfig" Text -> JourneyPushMessage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (JourneyPushMessage -> Pair)
-> Maybe JourneyPushMessage -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe JourneyPushMessage
messageConfig
]
)