{-# 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.DefaultButtonConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.ButtonAction
import qualified Amazonka.Prelude as Prelude
data DefaultButtonConfiguration = DefaultButtonConfiguration'
{
DefaultButtonConfiguration -> Maybe Text
link :: Prelude.Maybe Prelude.Text,
DefaultButtonConfiguration -> Maybe Text
backgroundColor :: Prelude.Maybe Prelude.Text,
DefaultButtonConfiguration -> Maybe Int
borderRadius :: Prelude.Maybe Prelude.Int,
DefaultButtonConfiguration -> Maybe Text
textColor :: Prelude.Maybe Prelude.Text,
DefaultButtonConfiguration -> ButtonAction
buttonAction :: ButtonAction,
DefaultButtonConfiguration -> Text
text :: Prelude.Text
}
deriving (DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool
(DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool)
-> (DefaultButtonConfiguration
-> DefaultButtonConfiguration -> Bool)
-> Eq DefaultButtonConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool
$c/= :: DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool
== :: DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool
$c== :: DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool
Prelude.Eq, ReadPrec [DefaultButtonConfiguration]
ReadPrec DefaultButtonConfiguration
Int -> ReadS DefaultButtonConfiguration
ReadS [DefaultButtonConfiguration]
(Int -> ReadS DefaultButtonConfiguration)
-> ReadS [DefaultButtonConfiguration]
-> ReadPrec DefaultButtonConfiguration
-> ReadPrec [DefaultButtonConfiguration]
-> Read DefaultButtonConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefaultButtonConfiguration]
$creadListPrec :: ReadPrec [DefaultButtonConfiguration]
readPrec :: ReadPrec DefaultButtonConfiguration
$creadPrec :: ReadPrec DefaultButtonConfiguration
readList :: ReadS [DefaultButtonConfiguration]
$creadList :: ReadS [DefaultButtonConfiguration]
readsPrec :: Int -> ReadS DefaultButtonConfiguration
$creadsPrec :: Int -> ReadS DefaultButtonConfiguration
Prelude.Read, Int -> DefaultButtonConfiguration -> ShowS
[DefaultButtonConfiguration] -> ShowS
DefaultButtonConfiguration -> String
(Int -> DefaultButtonConfiguration -> ShowS)
-> (DefaultButtonConfiguration -> String)
-> ([DefaultButtonConfiguration] -> ShowS)
-> Show DefaultButtonConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefaultButtonConfiguration] -> ShowS
$cshowList :: [DefaultButtonConfiguration] -> ShowS
show :: DefaultButtonConfiguration -> String
$cshow :: DefaultButtonConfiguration -> String
showsPrec :: Int -> DefaultButtonConfiguration -> ShowS
$cshowsPrec :: Int -> DefaultButtonConfiguration -> ShowS
Prelude.Show, (forall x.
DefaultButtonConfiguration -> Rep DefaultButtonConfiguration x)
-> (forall x.
Rep DefaultButtonConfiguration x -> DefaultButtonConfiguration)
-> Generic DefaultButtonConfiguration
forall x.
Rep DefaultButtonConfiguration x -> DefaultButtonConfiguration
forall x.
DefaultButtonConfiguration -> Rep DefaultButtonConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DefaultButtonConfiguration x -> DefaultButtonConfiguration
$cfrom :: forall x.
DefaultButtonConfiguration -> Rep DefaultButtonConfiguration x
Prelude.Generic)
newDefaultButtonConfiguration ::
ButtonAction ->
Prelude.Text ->
DefaultButtonConfiguration
newDefaultButtonConfiguration :: ButtonAction -> Text -> DefaultButtonConfiguration
newDefaultButtonConfiguration ButtonAction
pButtonAction_ Text
pText_ =
DefaultButtonConfiguration' :: Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> ButtonAction
-> Text
-> DefaultButtonConfiguration
DefaultButtonConfiguration'
{ $sel:link:DefaultButtonConfiguration' :: Maybe Text
link = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:backgroundColor:DefaultButtonConfiguration' :: Maybe Text
backgroundColor = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:borderRadius:DefaultButtonConfiguration' :: Maybe Int
borderRadius = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:textColor:DefaultButtonConfiguration' :: Maybe Text
textColor = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:buttonAction:DefaultButtonConfiguration' :: ButtonAction
buttonAction = ButtonAction
pButtonAction_,
$sel:text:DefaultButtonConfiguration' :: Text
text = Text
pText_
}
defaultButtonConfiguration_link :: Lens.Lens' DefaultButtonConfiguration (Prelude.Maybe Prelude.Text)
defaultButtonConfiguration_link :: (Maybe Text -> f (Maybe Text))
-> DefaultButtonConfiguration -> f DefaultButtonConfiguration
defaultButtonConfiguration_link = (DefaultButtonConfiguration -> Maybe Text)
-> (DefaultButtonConfiguration
-> Maybe Text -> DefaultButtonConfiguration)
-> Lens
DefaultButtonConfiguration
DefaultButtonConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {Maybe Text
link :: Maybe Text
$sel:link:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
link} -> Maybe Text
link) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} Maybe Text
a -> DefaultButtonConfiguration
s {$sel:link:DefaultButtonConfiguration' :: Maybe Text
link = Maybe Text
a} :: DefaultButtonConfiguration)
defaultButtonConfiguration_backgroundColor :: Lens.Lens' DefaultButtonConfiguration (Prelude.Maybe Prelude.Text)
defaultButtonConfiguration_backgroundColor :: (Maybe Text -> f (Maybe Text))
-> DefaultButtonConfiguration -> f DefaultButtonConfiguration
defaultButtonConfiguration_backgroundColor = (DefaultButtonConfiguration -> Maybe Text)
-> (DefaultButtonConfiguration
-> Maybe Text -> DefaultButtonConfiguration)
-> Lens
DefaultButtonConfiguration
DefaultButtonConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {Maybe Text
backgroundColor :: Maybe Text
$sel:backgroundColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
backgroundColor} -> Maybe Text
backgroundColor) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} Maybe Text
a -> DefaultButtonConfiguration
s {$sel:backgroundColor:DefaultButtonConfiguration' :: Maybe Text
backgroundColor = Maybe Text
a} :: DefaultButtonConfiguration)
defaultButtonConfiguration_borderRadius :: Lens.Lens' DefaultButtonConfiguration (Prelude.Maybe Prelude.Int)
defaultButtonConfiguration_borderRadius :: (Maybe Int -> f (Maybe Int))
-> DefaultButtonConfiguration -> f DefaultButtonConfiguration
defaultButtonConfiguration_borderRadius = (DefaultButtonConfiguration -> Maybe Int)
-> (DefaultButtonConfiguration
-> Maybe Int -> DefaultButtonConfiguration)
-> Lens
DefaultButtonConfiguration
DefaultButtonConfiguration
(Maybe Int)
(Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {Maybe Int
borderRadius :: Maybe Int
$sel:borderRadius:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Int
borderRadius} -> Maybe Int
borderRadius) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} Maybe Int
a -> DefaultButtonConfiguration
s {$sel:borderRadius:DefaultButtonConfiguration' :: Maybe Int
borderRadius = Maybe Int
a} :: DefaultButtonConfiguration)
defaultButtonConfiguration_textColor :: Lens.Lens' DefaultButtonConfiguration (Prelude.Maybe Prelude.Text)
defaultButtonConfiguration_textColor :: (Maybe Text -> f (Maybe Text))
-> DefaultButtonConfiguration -> f DefaultButtonConfiguration
defaultButtonConfiguration_textColor = (DefaultButtonConfiguration -> Maybe Text)
-> (DefaultButtonConfiguration
-> Maybe Text -> DefaultButtonConfiguration)
-> Lens
DefaultButtonConfiguration
DefaultButtonConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {Maybe Text
textColor :: Maybe Text
$sel:textColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
textColor} -> Maybe Text
textColor) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} Maybe Text
a -> DefaultButtonConfiguration
s {$sel:textColor:DefaultButtonConfiguration' :: Maybe Text
textColor = Maybe Text
a} :: DefaultButtonConfiguration)
defaultButtonConfiguration_buttonAction :: Lens.Lens' DefaultButtonConfiguration ButtonAction
defaultButtonConfiguration_buttonAction :: (ButtonAction -> f ButtonAction)
-> DefaultButtonConfiguration -> f DefaultButtonConfiguration
defaultButtonConfiguration_buttonAction = (DefaultButtonConfiguration -> ButtonAction)
-> (DefaultButtonConfiguration
-> ButtonAction -> DefaultButtonConfiguration)
-> Lens
DefaultButtonConfiguration
DefaultButtonConfiguration
ButtonAction
ButtonAction
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {ButtonAction
buttonAction :: ButtonAction
$sel:buttonAction:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> ButtonAction
buttonAction} -> ButtonAction
buttonAction) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} ButtonAction
a -> DefaultButtonConfiguration
s {$sel:buttonAction:DefaultButtonConfiguration' :: ButtonAction
buttonAction = ButtonAction
a} :: DefaultButtonConfiguration)
defaultButtonConfiguration_text :: Lens.Lens' DefaultButtonConfiguration Prelude.Text
defaultButtonConfiguration_text :: (Text -> f Text)
-> DefaultButtonConfiguration -> f DefaultButtonConfiguration
defaultButtonConfiguration_text = (DefaultButtonConfiguration -> Text)
-> (DefaultButtonConfiguration
-> Text -> DefaultButtonConfiguration)
-> Lens
DefaultButtonConfiguration DefaultButtonConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {Text
text :: Text
$sel:text:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Text
text} -> Text
text) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} Text
a -> DefaultButtonConfiguration
s {$sel:text:DefaultButtonConfiguration' :: Text
text = Text
a} :: DefaultButtonConfiguration)
instance Core.FromJSON DefaultButtonConfiguration where
parseJSON :: Value -> Parser DefaultButtonConfiguration
parseJSON =
String
-> (Object -> Parser DefaultButtonConfiguration)
-> Value
-> Parser DefaultButtonConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DefaultButtonConfiguration"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> ButtonAction
-> Text
-> DefaultButtonConfiguration
DefaultButtonConfiguration'
(Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> ButtonAction
-> Text
-> DefaultButtonConfiguration)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Int
-> Maybe Text
-> ButtonAction
-> Text
-> DefaultButtonConfiguration)
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
"Link")
Parser
(Maybe Text
-> Maybe Int
-> Maybe Text
-> ButtonAction
-> Text
-> DefaultButtonConfiguration)
-> Parser (Maybe Text)
-> Parser
(Maybe Int
-> Maybe Text
-> ButtonAction
-> Text
-> DefaultButtonConfiguration)
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 Int
-> Maybe Text
-> ButtonAction
-> Text
-> DefaultButtonConfiguration)
-> Parser (Maybe Int)
-> Parser
(Maybe Text -> ButtonAction -> Text -> DefaultButtonConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BorderRadius")
Parser
(Maybe Text -> ButtonAction -> Text -> DefaultButtonConfiguration)
-> Parser (Maybe Text)
-> Parser (ButtonAction -> Text -> DefaultButtonConfiguration)
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
"TextColor")
Parser (ButtonAction -> Text -> DefaultButtonConfiguration)
-> Parser ButtonAction
-> Parser (Text -> DefaultButtonConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ButtonAction
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ButtonAction")
Parser (Text -> DefaultButtonConfiguration)
-> Parser Text -> Parser DefaultButtonConfiguration
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
"Text")
)
instance Prelude.Hashable DefaultButtonConfiguration
instance Prelude.NFData DefaultButtonConfiguration
instance Core.ToJSON DefaultButtonConfiguration where
toJSON :: DefaultButtonConfiguration -> Value
toJSON DefaultButtonConfiguration' {Maybe Int
Maybe Text
Text
ButtonAction
text :: Text
buttonAction :: ButtonAction
textColor :: Maybe Text
borderRadius :: Maybe Int
backgroundColor :: Maybe Text
link :: Maybe Text
$sel:text:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Text
$sel:buttonAction:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> ButtonAction
$sel:textColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
$sel:borderRadius:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Int
$sel:backgroundColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
$sel:link:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Link" 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
link,
(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
"BorderRadius" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
borderRadius,
(Text
"TextColor" 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
textColor,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ButtonAction" Text -> ButtonAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ButtonAction
buttonAction),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Text" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
text)
]
)