{-# 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.ReplacementEmailContent
-- 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.ReplacementEmailContent where

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

-- | The @ReplaceEmailContent@ object to be used for a specific
-- @BulkEmailEntry@. The @ReplacementTemplate@ can be specified within this
-- object.
--
-- /See:/ 'newReplacementEmailContent' smart constructor.
data ReplacementEmailContent = ReplacementEmailContent'
  { -- | The @ReplacementTemplate@ associated with @ReplacementEmailContent@.
    ReplacementEmailContent -> Maybe ReplacementTemplate
replacementTemplate :: Prelude.Maybe ReplacementTemplate
  }
  deriving (ReplacementEmailContent -> ReplacementEmailContent -> Bool
(ReplacementEmailContent -> ReplacementEmailContent -> Bool)
-> (ReplacementEmailContent -> ReplacementEmailContent -> Bool)
-> Eq ReplacementEmailContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplacementEmailContent -> ReplacementEmailContent -> Bool
$c/= :: ReplacementEmailContent -> ReplacementEmailContent -> Bool
== :: ReplacementEmailContent -> ReplacementEmailContent -> Bool
$c== :: ReplacementEmailContent -> ReplacementEmailContent -> Bool
Prelude.Eq, ReadPrec [ReplacementEmailContent]
ReadPrec ReplacementEmailContent
Int -> ReadS ReplacementEmailContent
ReadS [ReplacementEmailContent]
(Int -> ReadS ReplacementEmailContent)
-> ReadS [ReplacementEmailContent]
-> ReadPrec ReplacementEmailContent
-> ReadPrec [ReplacementEmailContent]
-> Read ReplacementEmailContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplacementEmailContent]
$creadListPrec :: ReadPrec [ReplacementEmailContent]
readPrec :: ReadPrec ReplacementEmailContent
$creadPrec :: ReadPrec ReplacementEmailContent
readList :: ReadS [ReplacementEmailContent]
$creadList :: ReadS [ReplacementEmailContent]
readsPrec :: Int -> ReadS ReplacementEmailContent
$creadsPrec :: Int -> ReadS ReplacementEmailContent
Prelude.Read, Int -> ReplacementEmailContent -> ShowS
[ReplacementEmailContent] -> ShowS
ReplacementEmailContent -> String
(Int -> ReplacementEmailContent -> ShowS)
-> (ReplacementEmailContent -> String)
-> ([ReplacementEmailContent] -> ShowS)
-> Show ReplacementEmailContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplacementEmailContent] -> ShowS
$cshowList :: [ReplacementEmailContent] -> ShowS
show :: ReplacementEmailContent -> String
$cshow :: ReplacementEmailContent -> String
showsPrec :: Int -> ReplacementEmailContent -> ShowS
$cshowsPrec :: Int -> ReplacementEmailContent -> ShowS
Prelude.Show, (forall x.
 ReplacementEmailContent -> Rep ReplacementEmailContent x)
-> (forall x.
    Rep ReplacementEmailContent x -> ReplacementEmailContent)
-> Generic ReplacementEmailContent
forall x. Rep ReplacementEmailContent x -> ReplacementEmailContent
forall x. ReplacementEmailContent -> Rep ReplacementEmailContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReplacementEmailContent x -> ReplacementEmailContent
$cfrom :: forall x. ReplacementEmailContent -> Rep ReplacementEmailContent x
Prelude.Generic)

-- |
-- Create a value of 'ReplacementEmailContent' 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:
--
-- 'replacementTemplate', 'replacementEmailContent_replacementTemplate' - The @ReplacementTemplate@ associated with @ReplacementEmailContent@.
newReplacementEmailContent ::
  ReplacementEmailContent
newReplacementEmailContent :: ReplacementEmailContent
newReplacementEmailContent =
  ReplacementEmailContent' :: Maybe ReplacementTemplate -> ReplacementEmailContent
ReplacementEmailContent'
    { $sel:replacementTemplate:ReplacementEmailContent' :: Maybe ReplacementTemplate
replacementTemplate =
        Maybe ReplacementTemplate
forall a. Maybe a
Prelude.Nothing
    }

-- | The @ReplacementTemplate@ associated with @ReplacementEmailContent@.
replacementEmailContent_replacementTemplate :: Lens.Lens' ReplacementEmailContent (Prelude.Maybe ReplacementTemplate)
replacementEmailContent_replacementTemplate :: (Maybe ReplacementTemplate -> f (Maybe ReplacementTemplate))
-> ReplacementEmailContent -> f ReplacementEmailContent
replacementEmailContent_replacementTemplate = (ReplacementEmailContent -> Maybe ReplacementTemplate)
-> (ReplacementEmailContent
    -> Maybe ReplacementTemplate -> ReplacementEmailContent)
-> Lens
     ReplacementEmailContent
     ReplacementEmailContent
     (Maybe ReplacementTemplate)
     (Maybe ReplacementTemplate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplacementEmailContent' {Maybe ReplacementTemplate
replacementTemplate :: Maybe ReplacementTemplate
$sel:replacementTemplate:ReplacementEmailContent' :: ReplacementEmailContent -> Maybe ReplacementTemplate
replacementTemplate} -> Maybe ReplacementTemplate
replacementTemplate) (\s :: ReplacementEmailContent
s@ReplacementEmailContent' {} Maybe ReplacementTemplate
a -> ReplacementEmailContent
s {$sel:replacementTemplate:ReplacementEmailContent' :: Maybe ReplacementTemplate
replacementTemplate = Maybe ReplacementTemplate
a} :: ReplacementEmailContent)

instance Prelude.Hashable ReplacementEmailContent

instance Prelude.NFData ReplacementEmailContent

instance Core.ToJSON ReplacementEmailContent where
  toJSON :: ReplacementEmailContent -> Value
toJSON ReplacementEmailContent' {Maybe ReplacementTemplate
replacementTemplate :: Maybe ReplacementTemplate
$sel:replacementTemplate:ReplacementEmailContent' :: ReplacementEmailContent -> Maybe ReplacementTemplate
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ReplacementTemplate" Text -> ReplacementTemplate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReplacementTemplate -> Pair)
-> Maybe ReplacementTemplate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReplacementTemplate
replacementTemplate
          ]
      )