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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object which contains @ReplacementTemplateData@ to be used for a
-- specific @BulkEmailEntry@.
--
-- /See:/ 'newReplacementTemplate' smart constructor.
data ReplacementTemplate = ReplacementTemplate'
  { -- | A list of replacement values to apply to the template. This parameter is
    -- a JSON object, typically consisting of key-value pairs in which the keys
    -- correspond to replacement tags in the email template.
    ReplacementTemplate -> Maybe Text
replacementTemplateData :: Prelude.Maybe Prelude.Text
  }
  deriving (ReplacementTemplate -> ReplacementTemplate -> Bool
(ReplacementTemplate -> ReplacementTemplate -> Bool)
-> (ReplacementTemplate -> ReplacementTemplate -> Bool)
-> Eq ReplacementTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplacementTemplate -> ReplacementTemplate -> Bool
$c/= :: ReplacementTemplate -> ReplacementTemplate -> Bool
== :: ReplacementTemplate -> ReplacementTemplate -> Bool
$c== :: ReplacementTemplate -> ReplacementTemplate -> Bool
Prelude.Eq, ReadPrec [ReplacementTemplate]
ReadPrec ReplacementTemplate
Int -> ReadS ReplacementTemplate
ReadS [ReplacementTemplate]
(Int -> ReadS ReplacementTemplate)
-> ReadS [ReplacementTemplate]
-> ReadPrec ReplacementTemplate
-> ReadPrec [ReplacementTemplate]
-> Read ReplacementTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplacementTemplate]
$creadListPrec :: ReadPrec [ReplacementTemplate]
readPrec :: ReadPrec ReplacementTemplate
$creadPrec :: ReadPrec ReplacementTemplate
readList :: ReadS [ReplacementTemplate]
$creadList :: ReadS [ReplacementTemplate]
readsPrec :: Int -> ReadS ReplacementTemplate
$creadsPrec :: Int -> ReadS ReplacementTemplate
Prelude.Read, Int -> ReplacementTemplate -> ShowS
[ReplacementTemplate] -> ShowS
ReplacementTemplate -> String
(Int -> ReplacementTemplate -> ShowS)
-> (ReplacementTemplate -> String)
-> ([ReplacementTemplate] -> ShowS)
-> Show ReplacementTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplacementTemplate] -> ShowS
$cshowList :: [ReplacementTemplate] -> ShowS
show :: ReplacementTemplate -> String
$cshow :: ReplacementTemplate -> String
showsPrec :: Int -> ReplacementTemplate -> ShowS
$cshowsPrec :: Int -> ReplacementTemplate -> ShowS
Prelude.Show, (forall x. ReplacementTemplate -> Rep ReplacementTemplate x)
-> (forall x. Rep ReplacementTemplate x -> ReplacementTemplate)
-> Generic ReplacementTemplate
forall x. Rep ReplacementTemplate x -> ReplacementTemplate
forall x. ReplacementTemplate -> Rep ReplacementTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReplacementTemplate x -> ReplacementTemplate
$cfrom :: forall x. ReplacementTemplate -> Rep ReplacementTemplate x
Prelude.Generic)

-- |
-- Create a value of 'ReplacementTemplate' 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:
--
-- 'replacementTemplateData', 'replacementTemplate_replacementTemplateData' - A list of replacement values to apply to the template. This parameter is
-- a JSON object, typically consisting of key-value pairs in which the keys
-- correspond to replacement tags in the email template.
newReplacementTemplate ::
  ReplacementTemplate
newReplacementTemplate :: ReplacementTemplate
newReplacementTemplate =
  ReplacementTemplate' :: Maybe Text -> ReplacementTemplate
ReplacementTemplate'
    { $sel:replacementTemplateData:ReplacementTemplate' :: Maybe Text
replacementTemplateData =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of replacement values to apply to the template. This parameter is
-- a JSON object, typically consisting of key-value pairs in which the keys
-- correspond to replacement tags in the email template.
replacementTemplate_replacementTemplateData :: Lens.Lens' ReplacementTemplate (Prelude.Maybe Prelude.Text)
replacementTemplate_replacementTemplateData :: (Maybe Text -> f (Maybe Text))
-> ReplacementTemplate -> f ReplacementTemplate
replacementTemplate_replacementTemplateData = (ReplacementTemplate -> Maybe Text)
-> (ReplacementTemplate -> Maybe Text -> ReplacementTemplate)
-> Lens
     ReplacementTemplate ReplacementTemplate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplacementTemplate' {Maybe Text
replacementTemplateData :: Maybe Text
$sel:replacementTemplateData:ReplacementTemplate' :: ReplacementTemplate -> Maybe Text
replacementTemplateData} -> Maybe Text
replacementTemplateData) (\s :: ReplacementTemplate
s@ReplacementTemplate' {} Maybe Text
a -> ReplacementTemplate
s {$sel:replacementTemplateData:ReplacementTemplate' :: Maybe Text
replacementTemplateData = Maybe Text
a} :: ReplacementTemplate)

instance Prelude.Hashable ReplacementTemplate

instance Prelude.NFData ReplacementTemplate

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