{-# 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.SuppressionAttributes
-- 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.SuppressionAttributes 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.SuppressionListReason

-- | An object that contains information about the email address suppression
-- preferences for your account in the current Amazon Web Services Region.
--
-- /See:/ 'newSuppressionAttributes' smart constructor.
data SuppressionAttributes = SuppressionAttributes'
  { -- | A list that contains the reasons that email addresses will be
    -- automatically added to the suppression list for your account. This list
    -- can contain any or all of the following:
    --
    -- -   @COMPLAINT@ – Amazon SES adds an email address to the suppression
    --     list for your account when a message sent to that address results in
    --     a complaint.
    --
    -- -   @BOUNCE@ – Amazon SES adds an email address to the suppression list
    --     for your account when a message sent to that address results in a
    --     hard bounce.
    SuppressionAttributes -> Maybe [SuppressionListReason]
suppressedReasons :: Prelude.Maybe [SuppressionListReason]
  }
  deriving (SuppressionAttributes -> SuppressionAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuppressionAttributes -> SuppressionAttributes -> Bool
$c/= :: SuppressionAttributes -> SuppressionAttributes -> Bool
== :: SuppressionAttributes -> SuppressionAttributes -> Bool
$c== :: SuppressionAttributes -> SuppressionAttributes -> Bool
Prelude.Eq, ReadPrec [SuppressionAttributes]
ReadPrec SuppressionAttributes
Int -> ReadS SuppressionAttributes
ReadS [SuppressionAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuppressionAttributes]
$creadListPrec :: ReadPrec [SuppressionAttributes]
readPrec :: ReadPrec SuppressionAttributes
$creadPrec :: ReadPrec SuppressionAttributes
readList :: ReadS [SuppressionAttributes]
$creadList :: ReadS [SuppressionAttributes]
readsPrec :: Int -> ReadS SuppressionAttributes
$creadsPrec :: Int -> ReadS SuppressionAttributes
Prelude.Read, Int -> SuppressionAttributes -> ShowS
[SuppressionAttributes] -> ShowS
SuppressionAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuppressionAttributes] -> ShowS
$cshowList :: [SuppressionAttributes] -> ShowS
show :: SuppressionAttributes -> String
$cshow :: SuppressionAttributes -> String
showsPrec :: Int -> SuppressionAttributes -> ShowS
$cshowsPrec :: Int -> SuppressionAttributes -> ShowS
Prelude.Show, forall x. Rep SuppressionAttributes x -> SuppressionAttributes
forall x. SuppressionAttributes -> Rep SuppressionAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SuppressionAttributes x -> SuppressionAttributes
$cfrom :: forall x. SuppressionAttributes -> Rep SuppressionAttributes x
Prelude.Generic)

-- |
-- Create a value of 'SuppressionAttributes' 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:
--
-- 'suppressedReasons', 'suppressionAttributes_suppressedReasons' - A list that contains the reasons that email addresses will be
-- automatically added to the suppression list for your account. This list
-- can contain any or all of the following:
--
-- -   @COMPLAINT@ – Amazon SES adds an email address to the suppression
--     list for your account when a message sent to that address results in
--     a complaint.
--
-- -   @BOUNCE@ – Amazon SES adds an email address to the suppression list
--     for your account when a message sent to that address results in a
--     hard bounce.
newSuppressionAttributes ::
  SuppressionAttributes
newSuppressionAttributes :: SuppressionAttributes
newSuppressionAttributes =
  SuppressionAttributes'
    { $sel:suppressedReasons:SuppressionAttributes' :: Maybe [SuppressionListReason]
suppressedReasons =
        forall a. Maybe a
Prelude.Nothing
    }

-- | A list that contains the reasons that email addresses will be
-- automatically added to the suppression list for your account. This list
-- can contain any or all of the following:
--
-- -   @COMPLAINT@ – Amazon SES adds an email address to the suppression
--     list for your account when a message sent to that address results in
--     a complaint.
--
-- -   @BOUNCE@ – Amazon SES adds an email address to the suppression list
--     for your account when a message sent to that address results in a
--     hard bounce.
suppressionAttributes_suppressedReasons :: Lens.Lens' SuppressionAttributes (Prelude.Maybe [SuppressionListReason])
suppressionAttributes_suppressedReasons :: Lens' SuppressionAttributes (Maybe [SuppressionListReason])
suppressionAttributes_suppressedReasons = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuppressionAttributes' {Maybe [SuppressionListReason]
suppressedReasons :: Maybe [SuppressionListReason]
$sel:suppressedReasons:SuppressionAttributes' :: SuppressionAttributes -> Maybe [SuppressionListReason]
suppressedReasons} -> Maybe [SuppressionListReason]
suppressedReasons) (\s :: SuppressionAttributes
s@SuppressionAttributes' {} Maybe [SuppressionListReason]
a -> SuppressionAttributes
s {$sel:suppressedReasons:SuppressionAttributes' :: Maybe [SuppressionListReason]
suppressedReasons = Maybe [SuppressionListReason]
a} :: SuppressionAttributes) 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

instance Data.FromJSON SuppressionAttributes where
  parseJSON :: Value -> Parser SuppressionAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SuppressionAttributes"
      ( \Object
x ->
          Maybe [SuppressionListReason] -> SuppressionAttributes
SuppressionAttributes'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SuppressedReasons"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable SuppressionAttributes where
  hashWithSalt :: Int -> SuppressionAttributes -> Int
hashWithSalt Int
_salt SuppressionAttributes' {Maybe [SuppressionListReason]
suppressedReasons :: Maybe [SuppressionListReason]
$sel:suppressedReasons:SuppressionAttributes' :: SuppressionAttributes -> Maybe [SuppressionListReason]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SuppressionListReason]
suppressedReasons

instance Prelude.NFData SuppressionAttributes where
  rnf :: SuppressionAttributes -> ()
rnf SuppressionAttributes' {Maybe [SuppressionListReason]
suppressedReasons :: Maybe [SuppressionListReason]
$sel:suppressedReasons:SuppressionAttributes' :: SuppressionAttributes -> Maybe [SuppressionListReason]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SuppressionListReason]
suppressedReasons