{-# 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.InAppMessageContent where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.InAppMessageBodyConfig
import Amazonka.Pinpoint.Types.InAppMessageButton
import Amazonka.Pinpoint.Types.InAppMessageHeaderConfig
import qualified Amazonka.Prelude as Prelude
data InAppMessageContent = InAppMessageContent'
{
InAppMessageContent -> Maybe InAppMessageButton
primaryBtn :: Prelude.Maybe InAppMessageButton,
InAppMessageContent -> Maybe InAppMessageBodyConfig
bodyConfig :: Prelude.Maybe InAppMessageBodyConfig,
InAppMessageContent -> Maybe Text
backgroundColor :: Prelude.Maybe Prelude.Text,
InAppMessageContent -> Maybe Text
imageUrl :: Prelude.Maybe Prelude.Text,
InAppMessageContent -> Maybe InAppMessageButton
secondaryBtn :: Prelude.Maybe InAppMessageButton,
:: Prelude.Maybe InAppMessageHeaderConfig
}
deriving (InAppMessageContent -> InAppMessageContent -> Bool
(InAppMessageContent -> InAppMessageContent -> Bool)
-> (InAppMessageContent -> InAppMessageContent -> Bool)
-> Eq InAppMessageContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InAppMessageContent -> InAppMessageContent -> Bool
$c/= :: InAppMessageContent -> InAppMessageContent -> Bool
== :: InAppMessageContent -> InAppMessageContent -> Bool
$c== :: InAppMessageContent -> InAppMessageContent -> Bool
Prelude.Eq, ReadPrec [InAppMessageContent]
ReadPrec InAppMessageContent
Int -> ReadS InAppMessageContent
ReadS [InAppMessageContent]
(Int -> ReadS InAppMessageContent)
-> ReadS [InAppMessageContent]
-> ReadPrec InAppMessageContent
-> ReadPrec [InAppMessageContent]
-> Read InAppMessageContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InAppMessageContent]
$creadListPrec :: ReadPrec [InAppMessageContent]
readPrec :: ReadPrec InAppMessageContent
$creadPrec :: ReadPrec InAppMessageContent
readList :: ReadS [InAppMessageContent]
$creadList :: ReadS [InAppMessageContent]
readsPrec :: Int -> ReadS InAppMessageContent
$creadsPrec :: Int -> ReadS InAppMessageContent
Prelude.Read, Int -> InAppMessageContent -> ShowS
[InAppMessageContent] -> ShowS
InAppMessageContent -> String
(Int -> InAppMessageContent -> ShowS)
-> (InAppMessageContent -> String)
-> ([InAppMessageContent] -> ShowS)
-> Show InAppMessageContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InAppMessageContent] -> ShowS
$cshowList :: [InAppMessageContent] -> ShowS
show :: InAppMessageContent -> String
$cshow :: InAppMessageContent -> String
showsPrec :: Int -> InAppMessageContent -> ShowS
$cshowsPrec :: Int -> InAppMessageContent -> ShowS
Prelude.Show, (forall x. InAppMessageContent -> Rep InAppMessageContent x)
-> (forall x. Rep InAppMessageContent x -> InAppMessageContent)
-> Generic InAppMessageContent
forall x. Rep InAppMessageContent x -> InAppMessageContent
forall x. InAppMessageContent -> Rep InAppMessageContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InAppMessageContent x -> InAppMessageContent
$cfrom :: forall x. InAppMessageContent -> Rep InAppMessageContent x
Prelude.Generic)
newInAppMessageContent ::
InAppMessageContent
newInAppMessageContent :: InAppMessageContent
newInAppMessageContent =
InAppMessageContent' :: Maybe InAppMessageButton
-> Maybe InAppMessageBodyConfig
-> Maybe Text
-> Maybe Text
-> Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig
-> InAppMessageContent
InAppMessageContent'
{ $sel:primaryBtn:InAppMessageContent' :: Maybe InAppMessageButton
primaryBtn = Maybe InAppMessageButton
forall a. Maybe a
Prelude.Nothing,
$sel:bodyConfig:InAppMessageContent' :: Maybe InAppMessageBodyConfig
bodyConfig = Maybe InAppMessageBodyConfig
forall a. Maybe a
Prelude.Nothing,
$sel:backgroundColor:InAppMessageContent' :: Maybe Text
backgroundColor = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:imageUrl:InAppMessageContent' :: Maybe Text
imageUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:secondaryBtn:InAppMessageContent' :: Maybe InAppMessageButton
secondaryBtn = Maybe InAppMessageButton
forall a. Maybe a
Prelude.Nothing,
$sel:headerConfig:InAppMessageContent' :: Maybe InAppMessageHeaderConfig
headerConfig = Maybe InAppMessageHeaderConfig
forall a. Maybe a
Prelude.Nothing
}
inAppMessageContent_primaryBtn :: Lens.Lens' InAppMessageContent (Prelude.Maybe InAppMessageButton)
inAppMessageContent_primaryBtn :: (Maybe InAppMessageButton -> f (Maybe InAppMessageButton))
-> InAppMessageContent -> f InAppMessageContent
inAppMessageContent_primaryBtn = (InAppMessageContent -> Maybe InAppMessageButton)
-> (InAppMessageContent
-> Maybe InAppMessageButton -> InAppMessageContent)
-> Lens
InAppMessageContent
InAppMessageContent
(Maybe InAppMessageButton)
(Maybe InAppMessageButton)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageContent' {Maybe InAppMessageButton
primaryBtn :: Maybe InAppMessageButton
$sel:primaryBtn:InAppMessageContent' :: InAppMessageContent -> Maybe InAppMessageButton
primaryBtn} -> Maybe InAppMessageButton
primaryBtn) (\s :: InAppMessageContent
s@InAppMessageContent' {} Maybe InAppMessageButton
a -> InAppMessageContent
s {$sel:primaryBtn:InAppMessageContent' :: Maybe InAppMessageButton
primaryBtn = Maybe InAppMessageButton
a} :: InAppMessageContent)
inAppMessageContent_bodyConfig :: Lens.Lens' InAppMessageContent (Prelude.Maybe InAppMessageBodyConfig)
inAppMessageContent_bodyConfig :: (Maybe InAppMessageBodyConfig -> f (Maybe InAppMessageBodyConfig))
-> InAppMessageContent -> f InAppMessageContent
inAppMessageContent_bodyConfig = (InAppMessageContent -> Maybe InAppMessageBodyConfig)
-> (InAppMessageContent
-> Maybe InAppMessageBodyConfig -> InAppMessageContent)
-> Lens
InAppMessageContent
InAppMessageContent
(Maybe InAppMessageBodyConfig)
(Maybe InAppMessageBodyConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageContent' {Maybe InAppMessageBodyConfig
bodyConfig :: Maybe InAppMessageBodyConfig
$sel:bodyConfig:InAppMessageContent' :: InAppMessageContent -> Maybe InAppMessageBodyConfig
bodyConfig} -> Maybe InAppMessageBodyConfig
bodyConfig) (\s :: InAppMessageContent
s@InAppMessageContent' {} Maybe InAppMessageBodyConfig
a -> InAppMessageContent
s {$sel:bodyConfig:InAppMessageContent' :: Maybe InAppMessageBodyConfig
bodyConfig = Maybe InAppMessageBodyConfig
a} :: InAppMessageContent)
inAppMessageContent_backgroundColor :: Lens.Lens' InAppMessageContent (Prelude.Maybe Prelude.Text)
inAppMessageContent_backgroundColor :: (Maybe Text -> f (Maybe Text))
-> InAppMessageContent -> f InAppMessageContent
inAppMessageContent_backgroundColor = (InAppMessageContent -> Maybe Text)
-> (InAppMessageContent -> Maybe Text -> InAppMessageContent)
-> Lens
InAppMessageContent InAppMessageContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageContent' {Maybe Text
backgroundColor :: Maybe Text
$sel:backgroundColor:InAppMessageContent' :: InAppMessageContent -> Maybe Text
backgroundColor} -> Maybe Text
backgroundColor) (\s :: InAppMessageContent
s@InAppMessageContent' {} Maybe Text
a -> InAppMessageContent
s {$sel:backgroundColor:InAppMessageContent' :: Maybe Text
backgroundColor = Maybe Text
a} :: InAppMessageContent)
inAppMessageContent_imageUrl :: Lens.Lens' InAppMessageContent (Prelude.Maybe Prelude.Text)
inAppMessageContent_imageUrl :: (Maybe Text -> f (Maybe Text))
-> InAppMessageContent -> f InAppMessageContent
inAppMessageContent_imageUrl = (InAppMessageContent -> Maybe Text)
-> (InAppMessageContent -> Maybe Text -> InAppMessageContent)
-> Lens
InAppMessageContent InAppMessageContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageContent' {Maybe Text
imageUrl :: Maybe Text
$sel:imageUrl:InAppMessageContent' :: InAppMessageContent -> Maybe Text
imageUrl} -> Maybe Text
imageUrl) (\s :: InAppMessageContent
s@InAppMessageContent' {} Maybe Text
a -> InAppMessageContent
s {$sel:imageUrl:InAppMessageContent' :: Maybe Text
imageUrl = Maybe Text
a} :: InAppMessageContent)
inAppMessageContent_secondaryBtn :: Lens.Lens' InAppMessageContent (Prelude.Maybe InAppMessageButton)
inAppMessageContent_secondaryBtn :: (Maybe InAppMessageButton -> f (Maybe InAppMessageButton))
-> InAppMessageContent -> f InAppMessageContent
inAppMessageContent_secondaryBtn = (InAppMessageContent -> Maybe InAppMessageButton)
-> (InAppMessageContent
-> Maybe InAppMessageButton -> InAppMessageContent)
-> Lens
InAppMessageContent
InAppMessageContent
(Maybe InAppMessageButton)
(Maybe InAppMessageButton)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageContent' {Maybe InAppMessageButton
secondaryBtn :: Maybe InAppMessageButton
$sel:secondaryBtn:InAppMessageContent' :: InAppMessageContent -> Maybe InAppMessageButton
secondaryBtn} -> Maybe InAppMessageButton
secondaryBtn) (\s :: InAppMessageContent
s@InAppMessageContent' {} Maybe InAppMessageButton
a -> InAppMessageContent
s {$sel:secondaryBtn:InAppMessageContent' :: Maybe InAppMessageButton
secondaryBtn = Maybe InAppMessageButton
a} :: InAppMessageContent)
inAppMessageContent_headerConfig :: Lens.Lens' InAppMessageContent (Prelude.Maybe InAppMessageHeaderConfig)
= (InAppMessageContent -> Maybe InAppMessageHeaderConfig)
-> (InAppMessageContent
-> Maybe InAppMessageHeaderConfig -> InAppMessageContent)
-> Lens
InAppMessageContent
InAppMessageContent
(Maybe InAppMessageHeaderConfig)
(Maybe InAppMessageHeaderConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageContent' {Maybe InAppMessageHeaderConfig
headerConfig :: Maybe InAppMessageHeaderConfig
$sel:headerConfig:InAppMessageContent' :: InAppMessageContent -> Maybe InAppMessageHeaderConfig
headerConfig} -> Maybe InAppMessageHeaderConfig
headerConfig) (\s :: InAppMessageContent
s@InAppMessageContent' {} Maybe InAppMessageHeaderConfig
a -> InAppMessageContent
s {$sel:headerConfig:InAppMessageContent' :: Maybe InAppMessageHeaderConfig
headerConfig = Maybe InAppMessageHeaderConfig
a} :: InAppMessageContent)
instance Core.FromJSON InAppMessageContent where
parseJSON :: Value -> Parser InAppMessageContent
parseJSON =
String
-> (Object -> Parser InAppMessageContent)
-> Value
-> Parser InAppMessageContent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"InAppMessageContent"
( \Object
x ->
Maybe InAppMessageButton
-> Maybe InAppMessageBodyConfig
-> Maybe Text
-> Maybe Text
-> Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig
-> InAppMessageContent
InAppMessageContent'
(Maybe InAppMessageButton
-> Maybe InAppMessageBodyConfig
-> Maybe Text
-> Maybe Text
-> Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig
-> InAppMessageContent)
-> Parser (Maybe InAppMessageButton)
-> Parser
(Maybe InAppMessageBodyConfig
-> Maybe Text
-> Maybe Text
-> Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig
-> InAppMessageContent)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe InAppMessageButton)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PrimaryBtn")
Parser
(Maybe InAppMessageBodyConfig
-> Maybe Text
-> Maybe Text
-> Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig
-> InAppMessageContent)
-> Parser (Maybe InAppMessageBodyConfig)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig
-> InAppMessageContent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InAppMessageBodyConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BodyConfig")
Parser
(Maybe Text
-> Maybe Text
-> Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig
-> InAppMessageContent)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig
-> InAppMessageContent)
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
"BackgroundColor")
Parser
(Maybe Text
-> Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig
-> InAppMessageContent)
-> Parser (Maybe Text)
-> Parser
(Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig -> InAppMessageContent)
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
"ImageUrl")
Parser
(Maybe InAppMessageButton
-> Maybe InAppMessageHeaderConfig -> InAppMessageContent)
-> Parser (Maybe InAppMessageButton)
-> Parser (Maybe InAppMessageHeaderConfig -> InAppMessageContent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InAppMessageButton)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SecondaryBtn")
Parser (Maybe InAppMessageHeaderConfig -> InAppMessageContent)
-> Parser (Maybe InAppMessageHeaderConfig)
-> Parser InAppMessageContent
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InAppMessageHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HeaderConfig")
)
instance Prelude.Hashable InAppMessageContent
instance Prelude.NFData InAppMessageContent
instance Core.ToJSON InAppMessageContent where
toJSON :: InAppMessageContent -> Value
toJSON InAppMessageContent' {Maybe Text
Maybe InAppMessageBodyConfig
Maybe InAppMessageHeaderConfig
Maybe InAppMessageButton
headerConfig :: Maybe InAppMessageHeaderConfig
secondaryBtn :: Maybe InAppMessageButton
imageUrl :: Maybe Text
backgroundColor :: Maybe Text
bodyConfig :: Maybe InAppMessageBodyConfig
primaryBtn :: Maybe InAppMessageButton
$sel:headerConfig:InAppMessageContent' :: InAppMessageContent -> Maybe InAppMessageHeaderConfig
$sel:secondaryBtn:InAppMessageContent' :: InAppMessageContent -> Maybe InAppMessageButton
$sel:imageUrl:InAppMessageContent' :: InAppMessageContent -> Maybe Text
$sel:backgroundColor:InAppMessageContent' :: InAppMessageContent -> Maybe Text
$sel:bodyConfig:InAppMessageContent' :: InAppMessageContent -> Maybe InAppMessageBodyConfig
$sel:primaryBtn:InAppMessageContent' :: InAppMessageContent -> Maybe InAppMessageButton
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PrimaryBtn" Text -> InAppMessageButton -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (InAppMessageButton -> Pair)
-> Maybe InAppMessageButton -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InAppMessageButton
primaryBtn,
(Text
"BodyConfig" Text -> InAppMessageBodyConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (InAppMessageBodyConfig -> Pair)
-> Maybe InAppMessageBodyConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InAppMessageBodyConfig
bodyConfig,
(Text
"BackgroundColor" 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
backgroundColor,
(Text
"ImageUrl" 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
imageUrl,
(Text
"SecondaryBtn" Text -> InAppMessageButton -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (InAppMessageButton -> Pair)
-> Maybe InAppMessageButton -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InAppMessageButton
secondaryBtn,
(Text
"HeaderConfig" Text -> InAppMessageHeaderConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (InAppMessageHeaderConfig -> Pair)
-> Maybe InAppMessageHeaderConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InAppMessageHeaderConfig
headerConfig
]
)