{-# 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.SuppressedDestination
-- 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.SuppressedDestination 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.SuppressedDestinationAttributes
import Amazonka.SESV2.Types.SuppressionListReason

-- | An object that contains information about an email address that is on
-- the suppression list for your account.
--
-- /See:/ 'newSuppressedDestination' smart constructor.
data SuppressedDestination = SuppressedDestination'
  { -- | An optional value that can contain additional information about the
    -- reasons that the address was added to the suppression list for your
    -- account.
    SuppressedDestination -> Maybe SuppressedDestinationAttributes
attributes :: Prelude.Maybe SuppressedDestinationAttributes,
    -- | The email address that is on the suppression list for your account.
    SuppressedDestination -> Text
emailAddress :: Prelude.Text,
    -- | The reason that the address was added to the suppression list for your
    -- account.
    SuppressedDestination -> SuppressionListReason
reason :: SuppressionListReason,
    -- | The date and time when the suppressed destination was last updated,
    -- shown in Unix time format.
    SuppressedDestination -> POSIX
lastUpdateTime :: Data.POSIX
  }
  deriving (SuppressedDestination -> SuppressedDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuppressedDestination -> SuppressedDestination -> Bool
$c/= :: SuppressedDestination -> SuppressedDestination -> Bool
== :: SuppressedDestination -> SuppressedDestination -> Bool
$c== :: SuppressedDestination -> SuppressedDestination -> Bool
Prelude.Eq, ReadPrec [SuppressedDestination]
ReadPrec SuppressedDestination
Int -> ReadS SuppressedDestination
ReadS [SuppressedDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuppressedDestination]
$creadListPrec :: ReadPrec [SuppressedDestination]
readPrec :: ReadPrec SuppressedDestination
$creadPrec :: ReadPrec SuppressedDestination
readList :: ReadS [SuppressedDestination]
$creadList :: ReadS [SuppressedDestination]
readsPrec :: Int -> ReadS SuppressedDestination
$creadsPrec :: Int -> ReadS SuppressedDestination
Prelude.Read, Int -> SuppressedDestination -> ShowS
[SuppressedDestination] -> ShowS
SuppressedDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuppressedDestination] -> ShowS
$cshowList :: [SuppressedDestination] -> ShowS
show :: SuppressedDestination -> String
$cshow :: SuppressedDestination -> String
showsPrec :: Int -> SuppressedDestination -> ShowS
$cshowsPrec :: Int -> SuppressedDestination -> ShowS
Prelude.Show, forall x. Rep SuppressedDestination x -> SuppressedDestination
forall x. SuppressedDestination -> Rep SuppressedDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SuppressedDestination x -> SuppressedDestination
$cfrom :: forall x. SuppressedDestination -> Rep SuppressedDestination x
Prelude.Generic)

-- |
-- Create a value of 'SuppressedDestination' 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:
--
-- 'attributes', 'suppressedDestination_attributes' - An optional value that can contain additional information about the
-- reasons that the address was added to the suppression list for your
-- account.
--
-- 'emailAddress', 'suppressedDestination_emailAddress' - The email address that is on the suppression list for your account.
--
-- 'reason', 'suppressedDestination_reason' - The reason that the address was added to the suppression list for your
-- account.
--
-- 'lastUpdateTime', 'suppressedDestination_lastUpdateTime' - The date and time when the suppressed destination was last updated,
-- shown in Unix time format.
newSuppressedDestination ::
  -- | 'emailAddress'
  Prelude.Text ->
  -- | 'reason'
  SuppressionListReason ->
  -- | 'lastUpdateTime'
  Prelude.UTCTime ->
  SuppressedDestination
newSuppressedDestination :: Text -> SuppressionListReason -> UTCTime -> SuppressedDestination
newSuppressedDestination
  Text
pEmailAddress_
  SuppressionListReason
pReason_
  UTCTime
pLastUpdateTime_ =
    SuppressedDestination'
      { $sel:attributes:SuppressedDestination' :: Maybe SuppressedDestinationAttributes
attributes =
          forall a. Maybe a
Prelude.Nothing,
        $sel:emailAddress:SuppressedDestination' :: Text
emailAddress = Text
pEmailAddress_,
        $sel:reason:SuppressedDestination' :: SuppressionListReason
reason = SuppressionListReason
pReason_,
        $sel:lastUpdateTime:SuppressedDestination' :: POSIX
lastUpdateTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdateTime_
      }

-- | An optional value that can contain additional information about the
-- reasons that the address was added to the suppression list for your
-- account.
suppressedDestination_attributes :: Lens.Lens' SuppressedDestination (Prelude.Maybe SuppressedDestinationAttributes)
suppressedDestination_attributes :: Lens' SuppressedDestination (Maybe SuppressedDestinationAttributes)
suppressedDestination_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuppressedDestination' {Maybe SuppressedDestinationAttributes
attributes :: Maybe SuppressedDestinationAttributes
$sel:attributes:SuppressedDestination' :: SuppressedDestination -> Maybe SuppressedDestinationAttributes
attributes} -> Maybe SuppressedDestinationAttributes
attributes) (\s :: SuppressedDestination
s@SuppressedDestination' {} Maybe SuppressedDestinationAttributes
a -> SuppressedDestination
s {$sel:attributes:SuppressedDestination' :: Maybe SuppressedDestinationAttributes
attributes = Maybe SuppressedDestinationAttributes
a} :: SuppressedDestination)

-- | The email address that is on the suppression list for your account.
suppressedDestination_emailAddress :: Lens.Lens' SuppressedDestination Prelude.Text
suppressedDestination_emailAddress :: Lens' SuppressedDestination Text
suppressedDestination_emailAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuppressedDestination' {Text
emailAddress :: Text
$sel:emailAddress:SuppressedDestination' :: SuppressedDestination -> Text
emailAddress} -> Text
emailAddress) (\s :: SuppressedDestination
s@SuppressedDestination' {} Text
a -> SuppressedDestination
s {$sel:emailAddress:SuppressedDestination' :: Text
emailAddress = Text
a} :: SuppressedDestination)

-- | The reason that the address was added to the suppression list for your
-- account.
suppressedDestination_reason :: Lens.Lens' SuppressedDestination SuppressionListReason
suppressedDestination_reason :: Lens' SuppressedDestination SuppressionListReason
suppressedDestination_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuppressedDestination' {SuppressionListReason
reason :: SuppressionListReason
$sel:reason:SuppressedDestination' :: SuppressedDestination -> SuppressionListReason
reason} -> SuppressionListReason
reason) (\s :: SuppressedDestination
s@SuppressedDestination' {} SuppressionListReason
a -> SuppressedDestination
s {$sel:reason:SuppressedDestination' :: SuppressionListReason
reason = SuppressionListReason
a} :: SuppressedDestination)

-- | The date and time when the suppressed destination was last updated,
-- shown in Unix time format.
suppressedDestination_lastUpdateTime :: Lens.Lens' SuppressedDestination Prelude.UTCTime
suppressedDestination_lastUpdateTime :: Lens' SuppressedDestination UTCTime
suppressedDestination_lastUpdateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuppressedDestination' {POSIX
lastUpdateTime :: POSIX
$sel:lastUpdateTime:SuppressedDestination' :: SuppressedDestination -> POSIX
lastUpdateTime} -> POSIX
lastUpdateTime) (\s :: SuppressedDestination
s@SuppressedDestination' {} POSIX
a -> SuppressedDestination
s {$sel:lastUpdateTime:SuppressedDestination' :: POSIX
lastUpdateTime = POSIX
a} :: SuppressedDestination) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON SuppressedDestination where
  parseJSON :: Value -> Parser SuppressedDestination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SuppressedDestination"
      ( \Object
x ->
          Maybe SuppressedDestinationAttributes
-> Text -> SuppressionListReason -> POSIX -> SuppressedDestination
SuppressedDestination'
            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
"Attributes")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"EmailAddress")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Reason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"LastUpdateTime")
      )

instance Prelude.Hashable SuppressedDestination where
  hashWithSalt :: Int -> SuppressedDestination -> Int
hashWithSalt Int
_salt SuppressedDestination' {Maybe SuppressedDestinationAttributes
Text
POSIX
SuppressionListReason
lastUpdateTime :: POSIX
reason :: SuppressionListReason
emailAddress :: Text
attributes :: Maybe SuppressedDestinationAttributes
$sel:lastUpdateTime:SuppressedDestination' :: SuppressedDestination -> POSIX
$sel:reason:SuppressedDestination' :: SuppressedDestination -> SuppressionListReason
$sel:emailAddress:SuppressedDestination' :: SuppressedDestination -> Text
$sel:attributes:SuppressedDestination' :: SuppressedDestination -> Maybe SuppressedDestinationAttributes
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SuppressedDestinationAttributes
attributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
emailAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SuppressionListReason
reason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
lastUpdateTime

instance Prelude.NFData SuppressedDestination where
  rnf :: SuppressedDestination -> ()
rnf SuppressedDestination' {Maybe SuppressedDestinationAttributes
Text
POSIX
SuppressionListReason
lastUpdateTime :: POSIX
reason :: SuppressionListReason
emailAddress :: Text
attributes :: Maybe SuppressedDestinationAttributes
$sel:lastUpdateTime:SuppressedDestination' :: SuppressedDestination -> POSIX
$sel:reason:SuppressedDestination' :: SuppressedDestination -> SuppressionListReason
$sel:emailAddress:SuppressedDestination' :: SuppressedDestination -> Text
$sel:attributes:SuppressedDestination' :: SuppressedDestination -> Maybe SuppressedDestinationAttributes
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SuppressedDestinationAttributes
attributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
emailAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SuppressionListReason
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
lastUpdateTime