{-# 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.AmplifyBackend.Types.EmailSettings where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EmailSettings = EmailSettings'
{
EmailSettings -> Maybe Text
emailSubject :: Prelude.Maybe Prelude.Text,
EmailSettings -> Maybe Text
emailMessage :: Prelude.Maybe Prelude.Text
}
deriving (EmailSettings -> EmailSettings -> Bool
(EmailSettings -> EmailSettings -> Bool)
-> (EmailSettings -> EmailSettings -> Bool) -> Eq EmailSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EmailSettings -> EmailSettings -> Bool
$c/= :: EmailSettings -> EmailSettings -> Bool
== :: EmailSettings -> EmailSettings -> Bool
$c== :: EmailSettings -> EmailSettings -> Bool
Prelude.Eq, ReadPrec [EmailSettings]
ReadPrec EmailSettings
Int -> ReadS EmailSettings
ReadS [EmailSettings]
(Int -> ReadS EmailSettings)
-> ReadS [EmailSettings]
-> ReadPrec EmailSettings
-> ReadPrec [EmailSettings]
-> Read EmailSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EmailSettings]
$creadListPrec :: ReadPrec [EmailSettings]
readPrec :: ReadPrec EmailSettings
$creadPrec :: ReadPrec EmailSettings
readList :: ReadS [EmailSettings]
$creadList :: ReadS [EmailSettings]
readsPrec :: Int -> ReadS EmailSettings
$creadsPrec :: Int -> ReadS EmailSettings
Prelude.Read, Int -> EmailSettings -> ShowS
[EmailSettings] -> ShowS
EmailSettings -> String
(Int -> EmailSettings -> ShowS)
-> (EmailSettings -> String)
-> ([EmailSettings] -> ShowS)
-> Show EmailSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EmailSettings] -> ShowS
$cshowList :: [EmailSettings] -> ShowS
show :: EmailSettings -> String
$cshow :: EmailSettings -> String
showsPrec :: Int -> EmailSettings -> ShowS
$cshowsPrec :: Int -> EmailSettings -> ShowS
Prelude.Show, (forall x. EmailSettings -> Rep EmailSettings x)
-> (forall x. Rep EmailSettings x -> EmailSettings)
-> Generic EmailSettings
forall x. Rep EmailSettings x -> EmailSettings
forall x. EmailSettings -> Rep EmailSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EmailSettings x -> EmailSettings
$cfrom :: forall x. EmailSettings -> Rep EmailSettings x
Prelude.Generic)
newEmailSettings ::
EmailSettings
newEmailSettings :: EmailSettings
newEmailSettings =
EmailSettings' :: Maybe Text -> Maybe Text -> EmailSettings
EmailSettings'
{ $sel:emailSubject:EmailSettings' :: Maybe Text
emailSubject = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:emailMessage:EmailSettings' :: Maybe Text
emailMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
emailSettings_emailSubject :: Lens.Lens' EmailSettings (Prelude.Maybe Prelude.Text)
emailSettings_emailSubject :: (Maybe Text -> f (Maybe Text)) -> EmailSettings -> f EmailSettings
emailSettings_emailSubject = (EmailSettings -> Maybe Text)
-> (EmailSettings -> Maybe Text -> EmailSettings)
-> Lens EmailSettings EmailSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailSettings' {Maybe Text
emailSubject :: Maybe Text
$sel:emailSubject:EmailSettings' :: EmailSettings -> Maybe Text
emailSubject} -> Maybe Text
emailSubject) (\s :: EmailSettings
s@EmailSettings' {} Maybe Text
a -> EmailSettings
s {$sel:emailSubject:EmailSettings' :: Maybe Text
emailSubject = Maybe Text
a} :: EmailSettings)
emailSettings_emailMessage :: Lens.Lens' EmailSettings (Prelude.Maybe Prelude.Text)
emailSettings_emailMessage :: (Maybe Text -> f (Maybe Text)) -> EmailSettings -> f EmailSettings
emailSettings_emailMessage = (EmailSettings -> Maybe Text)
-> (EmailSettings -> Maybe Text -> EmailSettings)
-> Lens EmailSettings EmailSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailSettings' {Maybe Text
emailMessage :: Maybe Text
$sel:emailMessage:EmailSettings' :: EmailSettings -> Maybe Text
emailMessage} -> Maybe Text
emailMessage) (\s :: EmailSettings
s@EmailSettings' {} Maybe Text
a -> EmailSettings
s {$sel:emailMessage:EmailSettings' :: Maybe Text
emailMessage = Maybe Text
a} :: EmailSettings)
instance Core.FromJSON EmailSettings where
parseJSON :: Value -> Parser EmailSettings
parseJSON =
String
-> (Object -> Parser EmailSettings)
-> Value
-> Parser EmailSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EmailSettings"
( \Object
x ->
Maybe Text -> Maybe Text -> EmailSettings
EmailSettings'
(Maybe Text -> Maybe Text -> EmailSettings)
-> Parser (Maybe Text) -> Parser (Maybe Text -> EmailSettings)
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
"emailSubject")
Parser (Maybe Text -> EmailSettings)
-> Parser (Maybe Text) -> Parser EmailSettings
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
"emailMessage")
)
instance Prelude.Hashable EmailSettings
instance Prelude.NFData EmailSettings
instance Core.ToJSON EmailSettings where
toJSON :: EmailSettings -> Value
toJSON EmailSettings' {Maybe Text
emailMessage :: Maybe Text
emailSubject :: Maybe Text
$sel:emailMessage:EmailSettings' :: EmailSettings -> Maybe Text
$sel:emailSubject:EmailSettings' :: EmailSettings -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"emailSubject" 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
emailSubject,
(Text
"emailMessage" 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
emailMessage
]
)