{-# 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.BulkEmailEntry
-- 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.BulkEmailEntry 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.Destination
import Amazonka.SESV2.Types.MessageTag
import Amazonka.SESV2.Types.ReplacementEmailContent

-- | /See:/ 'newBulkEmailEntry' smart constructor.
data BulkEmailEntry = BulkEmailEntry'
  { -- | The @ReplacementEmailContent@ associated with a @BulkEmailEntry@.
    BulkEmailEntry -> Maybe ReplacementEmailContent
replacementEmailContent :: Prelude.Maybe ReplacementEmailContent,
    -- | A list of tags, in the form of name\/value pairs, to apply to an email
    -- that you send using the @SendBulkTemplatedEmail@ operation. Tags
    -- correspond to characteristics of the email that you define, so that you
    -- can publish email sending events.
    BulkEmailEntry -> Maybe [MessageTag]
replacementTags :: Prelude.Maybe [MessageTag],
    -- | Represents the destination of the message, consisting of To:, CC:, and
    -- BCC: fields.
    --
    -- Amazon SES does not support the SMTPUTF8 extension, as described in
    -- <https://tools.ietf.org/html/rfc6531 RFC6531>. For this reason, the
    -- local part of a destination email address (the part of the email address
    -- that precedes the \@ sign) may only contain
    -- <https://en.wikipedia.org/wiki/Email_address#Local-part 7-bit ASCII characters>.
    -- If the domain part of an address (the part after the \@ sign) contains
    -- non-ASCII characters, they must be encoded using Punycode, as described
    -- in <https://tools.ietf.org/html/rfc3492.html RFC3492>.
    BulkEmailEntry -> Destination
destination :: Destination
  }
  deriving (BulkEmailEntry -> BulkEmailEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BulkEmailEntry -> BulkEmailEntry -> Bool
$c/= :: BulkEmailEntry -> BulkEmailEntry -> Bool
== :: BulkEmailEntry -> BulkEmailEntry -> Bool
$c== :: BulkEmailEntry -> BulkEmailEntry -> Bool
Prelude.Eq, ReadPrec [BulkEmailEntry]
ReadPrec BulkEmailEntry
Int -> ReadS BulkEmailEntry
ReadS [BulkEmailEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BulkEmailEntry]
$creadListPrec :: ReadPrec [BulkEmailEntry]
readPrec :: ReadPrec BulkEmailEntry
$creadPrec :: ReadPrec BulkEmailEntry
readList :: ReadS [BulkEmailEntry]
$creadList :: ReadS [BulkEmailEntry]
readsPrec :: Int -> ReadS BulkEmailEntry
$creadsPrec :: Int -> ReadS BulkEmailEntry
Prelude.Read, Int -> BulkEmailEntry -> ShowS
[BulkEmailEntry] -> ShowS
BulkEmailEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BulkEmailEntry] -> ShowS
$cshowList :: [BulkEmailEntry] -> ShowS
show :: BulkEmailEntry -> String
$cshow :: BulkEmailEntry -> String
showsPrec :: Int -> BulkEmailEntry -> ShowS
$cshowsPrec :: Int -> BulkEmailEntry -> ShowS
Prelude.Show, forall x. Rep BulkEmailEntry x -> BulkEmailEntry
forall x. BulkEmailEntry -> Rep BulkEmailEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BulkEmailEntry x -> BulkEmailEntry
$cfrom :: forall x. BulkEmailEntry -> Rep BulkEmailEntry x
Prelude.Generic)

-- |
-- Create a value of 'BulkEmailEntry' 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:
--
-- 'replacementEmailContent', 'bulkEmailEntry_replacementEmailContent' - The @ReplacementEmailContent@ associated with a @BulkEmailEntry@.
--
-- 'replacementTags', 'bulkEmailEntry_replacementTags' - A list of tags, in the form of name\/value pairs, to apply to an email
-- that you send using the @SendBulkTemplatedEmail@ operation. Tags
-- correspond to characteristics of the email that you define, so that you
-- can publish email sending events.
--
-- 'destination', 'bulkEmailEntry_destination' - Represents the destination of the message, consisting of To:, CC:, and
-- BCC: fields.
--
-- Amazon SES does not support the SMTPUTF8 extension, as described in
-- <https://tools.ietf.org/html/rfc6531 RFC6531>. For this reason, the
-- local part of a destination email address (the part of the email address
-- that precedes the \@ sign) may only contain
-- <https://en.wikipedia.org/wiki/Email_address#Local-part 7-bit ASCII characters>.
-- If the domain part of an address (the part after the \@ sign) contains
-- non-ASCII characters, they must be encoded using Punycode, as described
-- in <https://tools.ietf.org/html/rfc3492.html RFC3492>.
newBulkEmailEntry ::
  -- | 'destination'
  Destination ->
  BulkEmailEntry
newBulkEmailEntry :: Destination -> BulkEmailEntry
newBulkEmailEntry Destination
pDestination_ =
  BulkEmailEntry'
    { $sel:replacementEmailContent:BulkEmailEntry' :: Maybe ReplacementEmailContent
replacementEmailContent =
        forall a. Maybe a
Prelude.Nothing,
      $sel:replacementTags:BulkEmailEntry' :: Maybe [MessageTag]
replacementTags = forall a. Maybe a
Prelude.Nothing,
      $sel:destination:BulkEmailEntry' :: Destination
destination = Destination
pDestination_
    }

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

-- | A list of tags, in the form of name\/value pairs, to apply to an email
-- that you send using the @SendBulkTemplatedEmail@ operation. Tags
-- correspond to characteristics of the email that you define, so that you
-- can publish email sending events.
bulkEmailEntry_replacementTags :: Lens.Lens' BulkEmailEntry (Prelude.Maybe [MessageTag])
bulkEmailEntry_replacementTags :: Lens' BulkEmailEntry (Maybe [MessageTag])
bulkEmailEntry_replacementTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkEmailEntry' {Maybe [MessageTag]
replacementTags :: Maybe [MessageTag]
$sel:replacementTags:BulkEmailEntry' :: BulkEmailEntry -> Maybe [MessageTag]
replacementTags} -> Maybe [MessageTag]
replacementTags) (\s :: BulkEmailEntry
s@BulkEmailEntry' {} Maybe [MessageTag]
a -> BulkEmailEntry
s {$sel:replacementTags:BulkEmailEntry' :: Maybe [MessageTag]
replacementTags = Maybe [MessageTag]
a} :: BulkEmailEntry) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Represents the destination of the message, consisting of To:, CC:, and
-- BCC: fields.
--
-- Amazon SES does not support the SMTPUTF8 extension, as described in
-- <https://tools.ietf.org/html/rfc6531 RFC6531>. For this reason, the
-- local part of a destination email address (the part of the email address
-- that precedes the \@ sign) may only contain
-- <https://en.wikipedia.org/wiki/Email_address#Local-part 7-bit ASCII characters>.
-- If the domain part of an address (the part after the \@ sign) contains
-- non-ASCII characters, they must be encoded using Punycode, as described
-- in <https://tools.ietf.org/html/rfc3492.html RFC3492>.
bulkEmailEntry_destination :: Lens.Lens' BulkEmailEntry Destination
bulkEmailEntry_destination :: Lens' BulkEmailEntry Destination
bulkEmailEntry_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkEmailEntry' {Destination
destination :: Destination
$sel:destination:BulkEmailEntry' :: BulkEmailEntry -> Destination
destination} -> Destination
destination) (\s :: BulkEmailEntry
s@BulkEmailEntry' {} Destination
a -> BulkEmailEntry
s {$sel:destination:BulkEmailEntry' :: Destination
destination = Destination
a} :: BulkEmailEntry)

instance Prelude.Hashable BulkEmailEntry where
  hashWithSalt :: Int -> BulkEmailEntry -> Int
hashWithSalt Int
_salt BulkEmailEntry' {Maybe [MessageTag]
Maybe ReplacementEmailContent
Destination
destination :: Destination
replacementTags :: Maybe [MessageTag]
replacementEmailContent :: Maybe ReplacementEmailContent
$sel:destination:BulkEmailEntry' :: BulkEmailEntry -> Destination
$sel:replacementTags:BulkEmailEntry' :: BulkEmailEntry -> Maybe [MessageTag]
$sel:replacementEmailContent:BulkEmailEntry' :: BulkEmailEntry -> Maybe ReplacementEmailContent
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReplacementEmailContent
replacementEmailContent
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MessageTag]
replacementTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Destination
destination

instance Prelude.NFData BulkEmailEntry where
  rnf :: BulkEmailEntry -> ()
rnf BulkEmailEntry' {Maybe [MessageTag]
Maybe ReplacementEmailContent
Destination
destination :: Destination
replacementTags :: Maybe [MessageTag]
replacementEmailContent :: Maybe ReplacementEmailContent
$sel:destination:BulkEmailEntry' :: BulkEmailEntry -> Destination
$sel:replacementTags:BulkEmailEntry' :: BulkEmailEntry -> Maybe [MessageTag]
$sel:replacementEmailContent:BulkEmailEntry' :: BulkEmailEntry -> Maybe ReplacementEmailContent
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ReplacementEmailContent
replacementEmailContent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MessageTag]
replacementTags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Destination
destination

instance Data.ToJSON BulkEmailEntry where
  toJSON :: BulkEmailEntry -> Value
toJSON BulkEmailEntry' {Maybe [MessageTag]
Maybe ReplacementEmailContent
Destination
destination :: Destination
replacementTags :: Maybe [MessageTag]
replacementEmailContent :: Maybe ReplacementEmailContent
$sel:destination:BulkEmailEntry' :: BulkEmailEntry -> Destination
$sel:replacementTags:BulkEmailEntry' :: BulkEmailEntry -> Maybe [MessageTag]
$sel:replacementEmailContent:BulkEmailEntry' :: BulkEmailEntry -> Maybe ReplacementEmailContent
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ReplacementEmailContent" 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 ReplacementEmailContent
replacementEmailContent,
            (Key
"ReplacementTags" 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 [MessageTag]
replacementTags,
            forall a. a -> Maybe a
Prelude.Just (Key
"Destination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Destination
destination)
          ]
      )