{-# 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.JourneySMSMessage where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.MessageType
import qualified Amazonka.Prelude as Prelude
data JourneySMSMessage = JourneySMSMessage'
{
JourneySMSMessage -> Maybe Text
originationNumber :: Prelude.Maybe Prelude.Text,
JourneySMSMessage -> Maybe Text
templateId :: Prelude.Maybe Prelude.Text,
JourneySMSMessage -> Maybe MessageType
messageType :: Prelude.Maybe MessageType,
JourneySMSMessage -> Maybe Text
senderId :: Prelude.Maybe Prelude.Text,
JourneySMSMessage -> Maybe Text
entityId :: Prelude.Maybe Prelude.Text
}
deriving (JourneySMSMessage -> JourneySMSMessage -> Bool
(JourneySMSMessage -> JourneySMSMessage -> Bool)
-> (JourneySMSMessage -> JourneySMSMessage -> Bool)
-> Eq JourneySMSMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JourneySMSMessage -> JourneySMSMessage -> Bool
$c/= :: JourneySMSMessage -> JourneySMSMessage -> Bool
== :: JourneySMSMessage -> JourneySMSMessage -> Bool
$c== :: JourneySMSMessage -> JourneySMSMessage -> Bool
Prelude.Eq, ReadPrec [JourneySMSMessage]
ReadPrec JourneySMSMessage
Int -> ReadS JourneySMSMessage
ReadS [JourneySMSMessage]
(Int -> ReadS JourneySMSMessage)
-> ReadS [JourneySMSMessage]
-> ReadPrec JourneySMSMessage
-> ReadPrec [JourneySMSMessage]
-> Read JourneySMSMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JourneySMSMessage]
$creadListPrec :: ReadPrec [JourneySMSMessage]
readPrec :: ReadPrec JourneySMSMessage
$creadPrec :: ReadPrec JourneySMSMessage
readList :: ReadS [JourneySMSMessage]
$creadList :: ReadS [JourneySMSMessage]
readsPrec :: Int -> ReadS JourneySMSMessage
$creadsPrec :: Int -> ReadS JourneySMSMessage
Prelude.Read, Int -> JourneySMSMessage -> ShowS
[JourneySMSMessage] -> ShowS
JourneySMSMessage -> String
(Int -> JourneySMSMessage -> ShowS)
-> (JourneySMSMessage -> String)
-> ([JourneySMSMessage] -> ShowS)
-> Show JourneySMSMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JourneySMSMessage] -> ShowS
$cshowList :: [JourneySMSMessage] -> ShowS
show :: JourneySMSMessage -> String
$cshow :: JourneySMSMessage -> String
showsPrec :: Int -> JourneySMSMessage -> ShowS
$cshowsPrec :: Int -> JourneySMSMessage -> ShowS
Prelude.Show, (forall x. JourneySMSMessage -> Rep JourneySMSMessage x)
-> (forall x. Rep JourneySMSMessage x -> JourneySMSMessage)
-> Generic JourneySMSMessage
forall x. Rep JourneySMSMessage x -> JourneySMSMessage
forall x. JourneySMSMessage -> Rep JourneySMSMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JourneySMSMessage x -> JourneySMSMessage
$cfrom :: forall x. JourneySMSMessage -> Rep JourneySMSMessage x
Prelude.Generic)
newJourneySMSMessage ::
JourneySMSMessage
newJourneySMSMessage :: JourneySMSMessage
newJourneySMSMessage =
JourneySMSMessage' :: Maybe Text
-> Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> JourneySMSMessage
JourneySMSMessage'
{ $sel:originationNumber:JourneySMSMessage' :: Maybe Text
originationNumber =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:templateId:JourneySMSMessage' :: Maybe Text
templateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:messageType:JourneySMSMessage' :: Maybe MessageType
messageType = Maybe MessageType
forall a. Maybe a
Prelude.Nothing,
$sel:senderId:JourneySMSMessage' :: Maybe Text
senderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:entityId:JourneySMSMessage' :: Maybe Text
entityId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
journeySMSMessage_originationNumber :: Lens.Lens' JourneySMSMessage (Prelude.Maybe Prelude.Text)
journeySMSMessage_originationNumber :: (Maybe Text -> f (Maybe Text))
-> JourneySMSMessage -> f JourneySMSMessage
journeySMSMessage_originationNumber = (JourneySMSMessage -> Maybe Text)
-> (JourneySMSMessage -> Maybe Text -> JourneySMSMessage)
-> Lens
JourneySMSMessage JourneySMSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySMSMessage' {Maybe Text
originationNumber :: Maybe Text
$sel:originationNumber:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
originationNumber} -> Maybe Text
originationNumber) (\s :: JourneySMSMessage
s@JourneySMSMessage' {} Maybe Text
a -> JourneySMSMessage
s {$sel:originationNumber:JourneySMSMessage' :: Maybe Text
originationNumber = Maybe Text
a} :: JourneySMSMessage)
journeySMSMessage_templateId :: Lens.Lens' JourneySMSMessage (Prelude.Maybe Prelude.Text)
journeySMSMessage_templateId :: (Maybe Text -> f (Maybe Text))
-> JourneySMSMessage -> f JourneySMSMessage
journeySMSMessage_templateId = (JourneySMSMessage -> Maybe Text)
-> (JourneySMSMessage -> Maybe Text -> JourneySMSMessage)
-> Lens
JourneySMSMessage JourneySMSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySMSMessage' {Maybe Text
templateId :: Maybe Text
$sel:templateId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
templateId} -> Maybe Text
templateId) (\s :: JourneySMSMessage
s@JourneySMSMessage' {} Maybe Text
a -> JourneySMSMessage
s {$sel:templateId:JourneySMSMessage' :: Maybe Text
templateId = Maybe Text
a} :: JourneySMSMessage)
journeySMSMessage_messageType :: Lens.Lens' JourneySMSMessage (Prelude.Maybe MessageType)
journeySMSMessage_messageType :: (Maybe MessageType -> f (Maybe MessageType))
-> JourneySMSMessage -> f JourneySMSMessage
journeySMSMessage_messageType = (JourneySMSMessage -> Maybe MessageType)
-> (JourneySMSMessage -> Maybe MessageType -> JourneySMSMessage)
-> Lens
JourneySMSMessage
JourneySMSMessage
(Maybe MessageType)
(Maybe MessageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySMSMessage' {Maybe MessageType
messageType :: Maybe MessageType
$sel:messageType:JourneySMSMessage' :: JourneySMSMessage -> Maybe MessageType
messageType} -> Maybe MessageType
messageType) (\s :: JourneySMSMessage
s@JourneySMSMessage' {} Maybe MessageType
a -> JourneySMSMessage
s {$sel:messageType:JourneySMSMessage' :: Maybe MessageType
messageType = Maybe MessageType
a} :: JourneySMSMessage)
journeySMSMessage_senderId :: Lens.Lens' JourneySMSMessage (Prelude.Maybe Prelude.Text)
journeySMSMessage_senderId :: (Maybe Text -> f (Maybe Text))
-> JourneySMSMessage -> f JourneySMSMessage
journeySMSMessage_senderId = (JourneySMSMessage -> Maybe Text)
-> (JourneySMSMessage -> Maybe Text -> JourneySMSMessage)
-> Lens
JourneySMSMessage JourneySMSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySMSMessage' {Maybe Text
senderId :: Maybe Text
$sel:senderId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
senderId} -> Maybe Text
senderId) (\s :: JourneySMSMessage
s@JourneySMSMessage' {} Maybe Text
a -> JourneySMSMessage
s {$sel:senderId:JourneySMSMessage' :: Maybe Text
senderId = Maybe Text
a} :: JourneySMSMessage)
journeySMSMessage_entityId :: Lens.Lens' JourneySMSMessage (Prelude.Maybe Prelude.Text)
journeySMSMessage_entityId :: (Maybe Text -> f (Maybe Text))
-> JourneySMSMessage -> f JourneySMSMessage
journeySMSMessage_entityId = (JourneySMSMessage -> Maybe Text)
-> (JourneySMSMessage -> Maybe Text -> JourneySMSMessage)
-> Lens
JourneySMSMessage JourneySMSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySMSMessage' {Maybe Text
entityId :: Maybe Text
$sel:entityId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
entityId} -> Maybe Text
entityId) (\s :: JourneySMSMessage
s@JourneySMSMessage' {} Maybe Text
a -> JourneySMSMessage
s {$sel:entityId:JourneySMSMessage' :: Maybe Text
entityId = Maybe Text
a} :: JourneySMSMessage)
instance Core.FromJSON JourneySMSMessage where
parseJSON :: Value -> Parser JourneySMSMessage
parseJSON =
String
-> (Object -> Parser JourneySMSMessage)
-> Value
-> Parser JourneySMSMessage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"JourneySMSMessage"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> JourneySMSMessage
JourneySMSMessage'
(Maybe Text
-> Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> JourneySMSMessage)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> JourneySMSMessage)
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
"OriginationNumber")
Parser
(Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> JourneySMSMessage)
-> Parser (Maybe Text)
-> Parser
(Maybe MessageType
-> Maybe Text -> Maybe Text -> JourneySMSMessage)
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
"TemplateId")
Parser
(Maybe MessageType
-> Maybe Text -> Maybe Text -> JourneySMSMessage)
-> Parser (Maybe MessageType)
-> Parser (Maybe Text -> Maybe Text -> JourneySMSMessage)
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 Text -> Maybe Text -> JourneySMSMessage)
-> Parser (Maybe Text) -> Parser (Maybe Text -> JourneySMSMessage)
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
"SenderId")
Parser (Maybe Text -> JourneySMSMessage)
-> Parser (Maybe Text) -> Parser JourneySMSMessage
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
"EntityId")
)
instance Prelude.Hashable JourneySMSMessage
instance Prelude.NFData JourneySMSMessage
instance Core.ToJSON JourneySMSMessage where
toJSON :: JourneySMSMessage -> Value
toJSON JourneySMSMessage' {Maybe Text
Maybe MessageType
entityId :: Maybe Text
senderId :: Maybe Text
messageType :: Maybe MessageType
templateId :: Maybe Text
originationNumber :: Maybe Text
$sel:entityId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
$sel:senderId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
$sel:messageType:JourneySMSMessage' :: JourneySMSMessage -> Maybe MessageType
$sel:templateId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
$sel:originationNumber:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"OriginationNumber" 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
originationNumber,
(Text
"TemplateId" 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
templateId,
(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
"SenderId" 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
senderId,
(Text
"EntityId" 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
entityId
]
)