{-# 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.InAppMessageBodyConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.Alignment
import qualified Amazonka.Prelude as Prelude
data InAppMessageBodyConfig = InAppMessageBodyConfig'
{
InAppMessageBodyConfig -> Alignment
alignment :: Alignment,
InAppMessageBodyConfig -> Text
textColor :: Prelude.Text,
InAppMessageBodyConfig -> Text
body :: Prelude.Text
}
deriving (InAppMessageBodyConfig -> InAppMessageBodyConfig -> Bool
(InAppMessageBodyConfig -> InAppMessageBodyConfig -> Bool)
-> (InAppMessageBodyConfig -> InAppMessageBodyConfig -> Bool)
-> Eq InAppMessageBodyConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InAppMessageBodyConfig -> InAppMessageBodyConfig -> Bool
$c/= :: InAppMessageBodyConfig -> InAppMessageBodyConfig -> Bool
== :: InAppMessageBodyConfig -> InAppMessageBodyConfig -> Bool
$c== :: InAppMessageBodyConfig -> InAppMessageBodyConfig -> Bool
Prelude.Eq, ReadPrec [InAppMessageBodyConfig]
ReadPrec InAppMessageBodyConfig
Int -> ReadS InAppMessageBodyConfig
ReadS [InAppMessageBodyConfig]
(Int -> ReadS InAppMessageBodyConfig)
-> ReadS [InAppMessageBodyConfig]
-> ReadPrec InAppMessageBodyConfig
-> ReadPrec [InAppMessageBodyConfig]
-> Read InAppMessageBodyConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InAppMessageBodyConfig]
$creadListPrec :: ReadPrec [InAppMessageBodyConfig]
readPrec :: ReadPrec InAppMessageBodyConfig
$creadPrec :: ReadPrec InAppMessageBodyConfig
readList :: ReadS [InAppMessageBodyConfig]
$creadList :: ReadS [InAppMessageBodyConfig]
readsPrec :: Int -> ReadS InAppMessageBodyConfig
$creadsPrec :: Int -> ReadS InAppMessageBodyConfig
Prelude.Read, Int -> InAppMessageBodyConfig -> ShowS
[InAppMessageBodyConfig] -> ShowS
InAppMessageBodyConfig -> String
(Int -> InAppMessageBodyConfig -> ShowS)
-> (InAppMessageBodyConfig -> String)
-> ([InAppMessageBodyConfig] -> ShowS)
-> Show InAppMessageBodyConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InAppMessageBodyConfig] -> ShowS
$cshowList :: [InAppMessageBodyConfig] -> ShowS
show :: InAppMessageBodyConfig -> String
$cshow :: InAppMessageBodyConfig -> String
showsPrec :: Int -> InAppMessageBodyConfig -> ShowS
$cshowsPrec :: Int -> InAppMessageBodyConfig -> ShowS
Prelude.Show, (forall x. InAppMessageBodyConfig -> Rep InAppMessageBodyConfig x)
-> (forall x.
Rep InAppMessageBodyConfig x -> InAppMessageBodyConfig)
-> Generic InAppMessageBodyConfig
forall x. Rep InAppMessageBodyConfig x -> InAppMessageBodyConfig
forall x. InAppMessageBodyConfig -> Rep InAppMessageBodyConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InAppMessageBodyConfig x -> InAppMessageBodyConfig
$cfrom :: forall x. InAppMessageBodyConfig -> Rep InAppMessageBodyConfig x
Prelude.Generic)
newInAppMessageBodyConfig ::
Alignment ->
Prelude.Text ->
Prelude.Text ->
InAppMessageBodyConfig
newInAppMessageBodyConfig :: Alignment -> Text -> Text -> InAppMessageBodyConfig
newInAppMessageBodyConfig
Alignment
pAlignment_
Text
pTextColor_
Text
pBody_ =
InAppMessageBodyConfig' :: Alignment -> Text -> Text -> InAppMessageBodyConfig
InAppMessageBodyConfig'
{ $sel:alignment:InAppMessageBodyConfig' :: Alignment
alignment = Alignment
pAlignment_,
$sel:textColor:InAppMessageBodyConfig' :: Text
textColor = Text
pTextColor_,
$sel:body:InAppMessageBodyConfig' :: Text
body = Text
pBody_
}
inAppMessageBodyConfig_alignment :: Lens.Lens' InAppMessageBodyConfig Alignment
inAppMessageBodyConfig_alignment :: (Alignment -> f Alignment)
-> InAppMessageBodyConfig -> f InAppMessageBodyConfig
inAppMessageBodyConfig_alignment = (InAppMessageBodyConfig -> Alignment)
-> (InAppMessageBodyConfig -> Alignment -> InAppMessageBodyConfig)
-> Lens
InAppMessageBodyConfig InAppMessageBodyConfig Alignment Alignment
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageBodyConfig' {Alignment
alignment :: Alignment
$sel:alignment:InAppMessageBodyConfig' :: InAppMessageBodyConfig -> Alignment
alignment} -> Alignment
alignment) (\s :: InAppMessageBodyConfig
s@InAppMessageBodyConfig' {} Alignment
a -> InAppMessageBodyConfig
s {$sel:alignment:InAppMessageBodyConfig' :: Alignment
alignment = Alignment
a} :: InAppMessageBodyConfig)
inAppMessageBodyConfig_textColor :: Lens.Lens' InAppMessageBodyConfig Prelude.Text
inAppMessageBodyConfig_textColor :: (Text -> f Text)
-> InAppMessageBodyConfig -> f InAppMessageBodyConfig
inAppMessageBodyConfig_textColor = (InAppMessageBodyConfig -> Text)
-> (InAppMessageBodyConfig -> Text -> InAppMessageBodyConfig)
-> Lens InAppMessageBodyConfig InAppMessageBodyConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageBodyConfig' {Text
textColor :: Text
$sel:textColor:InAppMessageBodyConfig' :: InAppMessageBodyConfig -> Text
textColor} -> Text
textColor) (\s :: InAppMessageBodyConfig
s@InAppMessageBodyConfig' {} Text
a -> InAppMessageBodyConfig
s {$sel:textColor:InAppMessageBodyConfig' :: Text
textColor = Text
a} :: InAppMessageBodyConfig)
inAppMessageBodyConfig_body :: Lens.Lens' InAppMessageBodyConfig Prelude.Text
inAppMessageBodyConfig_body :: (Text -> f Text)
-> InAppMessageBodyConfig -> f InAppMessageBodyConfig
inAppMessageBodyConfig_body = (InAppMessageBodyConfig -> Text)
-> (InAppMessageBodyConfig -> Text -> InAppMessageBodyConfig)
-> Lens InAppMessageBodyConfig InAppMessageBodyConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageBodyConfig' {Text
body :: Text
$sel:body:InAppMessageBodyConfig' :: InAppMessageBodyConfig -> Text
body} -> Text
body) (\s :: InAppMessageBodyConfig
s@InAppMessageBodyConfig' {} Text
a -> InAppMessageBodyConfig
s {$sel:body:InAppMessageBodyConfig' :: Text
body = Text
a} :: InAppMessageBodyConfig)
instance Core.FromJSON InAppMessageBodyConfig where
parseJSON :: Value -> Parser InAppMessageBodyConfig
parseJSON =
String
-> (Object -> Parser InAppMessageBodyConfig)
-> Value
-> Parser InAppMessageBodyConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"InAppMessageBodyConfig"
( \Object
x ->
Alignment -> Text -> Text -> InAppMessageBodyConfig
InAppMessageBodyConfig'
(Alignment -> Text -> Text -> InAppMessageBodyConfig)
-> Parser Alignment
-> Parser (Text -> Text -> InAppMessageBodyConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Alignment
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Alignment")
Parser (Text -> Text -> InAppMessageBodyConfig)
-> Parser Text -> Parser (Text -> InAppMessageBodyConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TextColor")
Parser (Text -> InAppMessageBodyConfig)
-> Parser Text -> Parser InAppMessageBodyConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Body")
)
instance Prelude.Hashable InAppMessageBodyConfig
instance Prelude.NFData InAppMessageBodyConfig
instance Core.ToJSON InAppMessageBodyConfig where
toJSON :: InAppMessageBodyConfig -> Value
toJSON InAppMessageBodyConfig' {Text
Alignment
body :: Text
textColor :: Text
alignment :: Alignment
$sel:body:InAppMessageBodyConfig' :: InAppMessageBodyConfig -> Text
$sel:textColor:InAppMessageBodyConfig' :: InAppMessageBodyConfig -> Text
$sel:alignment:InAppMessageBodyConfig' :: InAppMessageBodyConfig -> Alignment
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Alignment" Text -> Alignment -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Alignment
alignment),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TextColor" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
textColor),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Body" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
body)
]
)