{-# 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.SESV2.Types.EmailContent where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SESV2.Types.Message
import Amazonka.SESV2.Types.RawMessage
import Amazonka.SESV2.Types.Template
data EmailContent = EmailContent'
{
EmailContent -> Maybe RawMessage
raw :: Prelude.Maybe RawMessage,
EmailContent -> Maybe Message
simple :: Prelude.Maybe Message,
EmailContent -> Maybe Template
template :: Prelude.Maybe Template
}
deriving (EmailContent -> EmailContent -> Bool
(EmailContent -> EmailContent -> Bool)
-> (EmailContent -> EmailContent -> Bool) -> Eq EmailContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EmailContent -> EmailContent -> Bool
$c/= :: EmailContent -> EmailContent -> Bool
== :: EmailContent -> EmailContent -> Bool
$c== :: EmailContent -> EmailContent -> Bool
Prelude.Eq, ReadPrec [EmailContent]
ReadPrec EmailContent
Int -> ReadS EmailContent
ReadS [EmailContent]
(Int -> ReadS EmailContent)
-> ReadS [EmailContent]
-> ReadPrec EmailContent
-> ReadPrec [EmailContent]
-> Read EmailContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EmailContent]
$creadListPrec :: ReadPrec [EmailContent]
readPrec :: ReadPrec EmailContent
$creadPrec :: ReadPrec EmailContent
readList :: ReadS [EmailContent]
$creadList :: ReadS [EmailContent]
readsPrec :: Int -> ReadS EmailContent
$creadsPrec :: Int -> ReadS EmailContent
Prelude.Read, Int -> EmailContent -> ShowS
[EmailContent] -> ShowS
EmailContent -> String
(Int -> EmailContent -> ShowS)
-> (EmailContent -> String)
-> ([EmailContent] -> ShowS)
-> Show EmailContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EmailContent] -> ShowS
$cshowList :: [EmailContent] -> ShowS
show :: EmailContent -> String
$cshow :: EmailContent -> String
showsPrec :: Int -> EmailContent -> ShowS
$cshowsPrec :: Int -> EmailContent -> ShowS
Prelude.Show, (forall x. EmailContent -> Rep EmailContent x)
-> (forall x. Rep EmailContent x -> EmailContent)
-> Generic EmailContent
forall x. Rep EmailContent x -> EmailContent
forall x. EmailContent -> Rep EmailContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EmailContent x -> EmailContent
$cfrom :: forall x. EmailContent -> Rep EmailContent x
Prelude.Generic)
newEmailContent ::
EmailContent
newEmailContent :: EmailContent
newEmailContent =
EmailContent' :: Maybe RawMessage -> Maybe Message -> Maybe Template -> EmailContent
EmailContent'
{ $sel:raw:EmailContent' :: Maybe RawMessage
raw = Maybe RawMessage
forall a. Maybe a
Prelude.Nothing,
$sel:simple:EmailContent' :: Maybe Message
simple = Maybe Message
forall a. Maybe a
Prelude.Nothing,
$sel:template:EmailContent' :: Maybe Template
template = Maybe Template
forall a. Maybe a
Prelude.Nothing
}
emailContent_raw :: Lens.Lens' EmailContent (Prelude.Maybe RawMessage)
emailContent_raw :: (Maybe RawMessage -> f (Maybe RawMessage))
-> EmailContent -> f EmailContent
emailContent_raw = (EmailContent -> Maybe RawMessage)
-> (EmailContent -> Maybe RawMessage -> EmailContent)
-> Lens
EmailContent EmailContent (Maybe RawMessage) (Maybe RawMessage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailContent' {Maybe RawMessage
raw :: Maybe RawMessage
$sel:raw:EmailContent' :: EmailContent -> Maybe RawMessage
raw} -> Maybe RawMessage
raw) (\s :: EmailContent
s@EmailContent' {} Maybe RawMessage
a -> EmailContent
s {$sel:raw:EmailContent' :: Maybe RawMessage
raw = Maybe RawMessage
a} :: EmailContent)
emailContent_simple :: Lens.Lens' EmailContent (Prelude.Maybe Message)
emailContent_simple :: (Maybe Message -> f (Maybe Message))
-> EmailContent -> f EmailContent
emailContent_simple = (EmailContent -> Maybe Message)
-> (EmailContent -> Maybe Message -> EmailContent)
-> Lens EmailContent EmailContent (Maybe Message) (Maybe Message)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailContent' {Maybe Message
simple :: Maybe Message
$sel:simple:EmailContent' :: EmailContent -> Maybe Message
simple} -> Maybe Message
simple) (\s :: EmailContent
s@EmailContent' {} Maybe Message
a -> EmailContent
s {$sel:simple:EmailContent' :: Maybe Message
simple = Maybe Message
a} :: EmailContent)
emailContent_template :: Lens.Lens' EmailContent (Prelude.Maybe Template)
emailContent_template :: (Maybe Template -> f (Maybe Template))
-> EmailContent -> f EmailContent
emailContent_template = (EmailContent -> Maybe Template)
-> (EmailContent -> Maybe Template -> EmailContent)
-> Lens EmailContent EmailContent (Maybe Template) (Maybe Template)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailContent' {Maybe Template
template :: Maybe Template
$sel:template:EmailContent' :: EmailContent -> Maybe Template
template} -> Maybe Template
template) (\s :: EmailContent
s@EmailContent' {} Maybe Template
a -> EmailContent
s {$sel:template:EmailContent' :: Maybe Template
template = Maybe Template
a} :: EmailContent)
instance Prelude.Hashable EmailContent
instance Prelude.NFData EmailContent
instance Core.ToJSON EmailContent where
toJSON :: EmailContent -> Value
toJSON EmailContent' {Maybe Message
Maybe RawMessage
Maybe Template
template :: Maybe Template
simple :: Maybe Message
raw :: Maybe RawMessage
$sel:template:EmailContent' :: EmailContent -> Maybe Template
$sel:simple:EmailContent' :: EmailContent -> Maybe Message
$sel:raw:EmailContent' :: EmailContent -> Maybe RawMessage
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Raw" Text -> RawMessage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RawMessage -> Pair) -> Maybe RawMessage -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RawMessage
raw,
(Text
"Simple" Text -> Message -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Message -> Pair) -> Maybe Message -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Message
simple,
(Text
"Template" Text -> Template -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Template -> Pair) -> Maybe Template -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Template
template
]
)