{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SESV2.Types.BulkEmailContent
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SESV2.Types.BulkEmailContent where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SESV2.Types.Template

-- | An object that contains the body of the message. You can specify a
-- template message.
--
-- /See:/ 'newBulkEmailContent' smart constructor.
data BulkEmailContent = BulkEmailContent'
  { -- | The template to use for the bulk email message.
    BulkEmailContent -> Maybe Template
template :: Prelude.Maybe Template
  }
  deriving (BulkEmailContent -> BulkEmailContent -> Bool
(BulkEmailContent -> BulkEmailContent -> Bool)
-> (BulkEmailContent -> BulkEmailContent -> Bool)
-> Eq BulkEmailContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BulkEmailContent -> BulkEmailContent -> Bool
$c/= :: BulkEmailContent -> BulkEmailContent -> Bool
== :: BulkEmailContent -> BulkEmailContent -> Bool
$c== :: BulkEmailContent -> BulkEmailContent -> Bool
Prelude.Eq, ReadPrec [BulkEmailContent]
ReadPrec BulkEmailContent
Int -> ReadS BulkEmailContent
ReadS [BulkEmailContent]
(Int -> ReadS BulkEmailContent)
-> ReadS [BulkEmailContent]
-> ReadPrec BulkEmailContent
-> ReadPrec [BulkEmailContent]
-> Read BulkEmailContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BulkEmailContent]
$creadListPrec :: ReadPrec [BulkEmailContent]
readPrec :: ReadPrec BulkEmailContent
$creadPrec :: ReadPrec BulkEmailContent
readList :: ReadS [BulkEmailContent]
$creadList :: ReadS [BulkEmailContent]
readsPrec :: Int -> ReadS BulkEmailContent
$creadsPrec :: Int -> ReadS BulkEmailContent
Prelude.Read, Int -> BulkEmailContent -> ShowS
[BulkEmailContent] -> ShowS
BulkEmailContent -> String
(Int -> BulkEmailContent -> ShowS)
-> (BulkEmailContent -> String)
-> ([BulkEmailContent] -> ShowS)
-> Show BulkEmailContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BulkEmailContent] -> ShowS
$cshowList :: [BulkEmailContent] -> ShowS
show :: BulkEmailContent -> String
$cshow :: BulkEmailContent -> String
showsPrec :: Int -> BulkEmailContent -> ShowS
$cshowsPrec :: Int -> BulkEmailContent -> ShowS
Prelude.Show, (forall x. BulkEmailContent -> Rep BulkEmailContent x)
-> (forall x. Rep BulkEmailContent x -> BulkEmailContent)
-> Generic BulkEmailContent
forall x. Rep BulkEmailContent x -> BulkEmailContent
forall x. BulkEmailContent -> Rep BulkEmailContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BulkEmailContent x -> BulkEmailContent
$cfrom :: forall x. BulkEmailContent -> Rep BulkEmailContent x
Prelude.Generic)

-- |
-- Create a value of 'BulkEmailContent' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'template', 'bulkEmailContent_template' - The template to use for the bulk email message.
newBulkEmailContent ::
  BulkEmailContent
newBulkEmailContent :: BulkEmailContent
newBulkEmailContent =
  BulkEmailContent' :: Maybe Template -> BulkEmailContent
BulkEmailContent' {$sel:template:BulkEmailContent' :: Maybe Template
template = Maybe Template
forall a. Maybe a
Prelude.Nothing}

-- | The template to use for the bulk email message.
bulkEmailContent_template :: Lens.Lens' BulkEmailContent (Prelude.Maybe Template)
bulkEmailContent_template :: (Maybe Template -> f (Maybe Template))
-> BulkEmailContent -> f BulkEmailContent
bulkEmailContent_template = (BulkEmailContent -> Maybe Template)
-> (BulkEmailContent -> Maybe Template -> BulkEmailContent)
-> Lens
     BulkEmailContent BulkEmailContent (Maybe Template) (Maybe Template)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkEmailContent' {Maybe Template
template :: Maybe Template
$sel:template:BulkEmailContent' :: BulkEmailContent -> Maybe Template
template} -> Maybe Template
template) (\s :: BulkEmailContent
s@BulkEmailContent' {} Maybe Template
a -> BulkEmailContent
s {$sel:template:BulkEmailContent' :: Maybe Template
template = Maybe Template
a} :: BulkEmailContent)

instance Prelude.Hashable BulkEmailContent

instance Prelude.NFData BulkEmailContent

instance Core.ToJSON BulkEmailContent where
  toJSON :: BulkEmailContent -> Value
toJSON BulkEmailContent' {Maybe Template
template :: Maybe Template
$sel:template:BulkEmailContent' :: BulkEmailContent -> Maybe Template
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(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]
      )