{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SESV2.Types.BulkEmailContent where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:template:BulkEmailContent' :: Maybe Template
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 :: Lens' BulkEmailContent (Maybe Template)
bulkEmailContent_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 where
  hashWithSalt :: Int -> BulkEmailContent -> Int
hashWithSalt Int
_salt BulkEmailContent' {Maybe Template
template :: Maybe Template
$sel:template:BulkEmailContent' :: BulkEmailContent -> Maybe Template
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Template
template

instance Prelude.NFData BulkEmailContent where
  rnf :: BulkEmailContent -> ()
rnf BulkEmailContent' {Maybe Template
template :: Maybe Template
$sel:template:BulkEmailContent' :: BulkEmailContent -> Maybe Template
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Template
template

instance Data.ToJSON BulkEmailContent where
  toJSON :: BulkEmailContent -> Value
toJSON BulkEmailContent' {Maybe Template
template :: Maybe Template
$sel:template:BulkEmailContent' :: BulkEmailContent -> Maybe Template
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Template" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Template
template]
      )