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

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

-- | A summary that describes the suppressed email address.
--
-- /See:/ 'newSuppressedDestinationSummary' smart constructor.
data SuppressedDestinationSummary = SuppressedDestinationSummary'
  { -- | The email address that\'s on the suppression list for your account.
    SuppressedDestinationSummary -> Text
emailAddress :: Prelude.Text,
    -- | The reason that the address was added to the suppression list for your
    -- account.
    SuppressedDestinationSummary -> SuppressionListReason
reason :: SuppressionListReason,
    -- | The date and time when the suppressed destination was last updated,
    -- shown in Unix time format.
    SuppressedDestinationSummary -> POSIX
lastUpdateTime :: Core.POSIX
  }
  deriving (SuppressedDestinationSummary
-> SuppressedDestinationSummary -> Bool
(SuppressedDestinationSummary
 -> SuppressedDestinationSummary -> Bool)
-> (SuppressedDestinationSummary
    -> SuppressedDestinationSummary -> Bool)
-> Eq SuppressedDestinationSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuppressedDestinationSummary
-> SuppressedDestinationSummary -> Bool
$c/= :: SuppressedDestinationSummary
-> SuppressedDestinationSummary -> Bool
== :: SuppressedDestinationSummary
-> SuppressedDestinationSummary -> Bool
$c== :: SuppressedDestinationSummary
-> SuppressedDestinationSummary -> Bool
Prelude.Eq, ReadPrec [SuppressedDestinationSummary]
ReadPrec SuppressedDestinationSummary
Int -> ReadS SuppressedDestinationSummary
ReadS [SuppressedDestinationSummary]
(Int -> ReadS SuppressedDestinationSummary)
-> ReadS [SuppressedDestinationSummary]
-> ReadPrec SuppressedDestinationSummary
-> ReadPrec [SuppressedDestinationSummary]
-> Read SuppressedDestinationSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuppressedDestinationSummary]
$creadListPrec :: ReadPrec [SuppressedDestinationSummary]
readPrec :: ReadPrec SuppressedDestinationSummary
$creadPrec :: ReadPrec SuppressedDestinationSummary
readList :: ReadS [SuppressedDestinationSummary]
$creadList :: ReadS [SuppressedDestinationSummary]
readsPrec :: Int -> ReadS SuppressedDestinationSummary
$creadsPrec :: Int -> ReadS SuppressedDestinationSummary
Prelude.Read, Int -> SuppressedDestinationSummary -> ShowS
[SuppressedDestinationSummary] -> ShowS
SuppressedDestinationSummary -> String
(Int -> SuppressedDestinationSummary -> ShowS)
-> (SuppressedDestinationSummary -> String)
-> ([SuppressedDestinationSummary] -> ShowS)
-> Show SuppressedDestinationSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuppressedDestinationSummary] -> ShowS
$cshowList :: [SuppressedDestinationSummary] -> ShowS
show :: SuppressedDestinationSummary -> String
$cshow :: SuppressedDestinationSummary -> String
showsPrec :: Int -> SuppressedDestinationSummary -> ShowS
$cshowsPrec :: Int -> SuppressedDestinationSummary -> ShowS
Prelude.Show, (forall x.
 SuppressedDestinationSummary -> Rep SuppressedDestinationSummary x)
-> (forall x.
    Rep SuppressedDestinationSummary x -> SuppressedDestinationSummary)
-> Generic SuppressedDestinationSummary
forall x.
Rep SuppressedDestinationSummary x -> SuppressedDestinationSummary
forall x.
SuppressedDestinationSummary -> Rep SuppressedDestinationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SuppressedDestinationSummary x -> SuppressedDestinationSummary
$cfrom :: forall x.
SuppressedDestinationSummary -> Rep SuppressedDestinationSummary x
Prelude.Generic)

-- |
-- Create a value of 'SuppressedDestinationSummary' 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:
--
-- 'emailAddress', 'suppressedDestinationSummary_emailAddress' - The email address that\'s on the suppression list for your account.
--
-- 'reason', 'suppressedDestinationSummary_reason' - The reason that the address was added to the suppression list for your
-- account.
--
-- 'lastUpdateTime', 'suppressedDestinationSummary_lastUpdateTime' - The date and time when the suppressed destination was last updated,
-- shown in Unix time format.
newSuppressedDestinationSummary ::
  -- | 'emailAddress'
  Prelude.Text ->
  -- | 'reason'
  SuppressionListReason ->
  -- | 'lastUpdateTime'
  Prelude.UTCTime ->
  SuppressedDestinationSummary
newSuppressedDestinationSummary :: Text
-> SuppressionListReason -> UTCTime -> SuppressedDestinationSummary
newSuppressedDestinationSummary
  Text
pEmailAddress_
  SuppressionListReason
pReason_
  UTCTime
pLastUpdateTime_ =
    SuppressedDestinationSummary' :: Text
-> SuppressionListReason -> POSIX -> SuppressedDestinationSummary
SuppressedDestinationSummary'
      { $sel:emailAddress:SuppressedDestinationSummary' :: Text
emailAddress =
          Text
pEmailAddress_,
        $sel:reason:SuppressedDestinationSummary' :: SuppressionListReason
reason = SuppressionListReason
pReason_,
        $sel:lastUpdateTime:SuppressedDestinationSummary' :: POSIX
lastUpdateTime =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdateTime_
      }

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

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

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

instance Core.FromJSON SuppressedDestinationSummary where
  parseJSON :: Value -> Parser SuppressedDestinationSummary
parseJSON =
    String
-> (Object -> Parser SuppressedDestinationSummary)
-> Value
-> Parser SuppressedDestinationSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SuppressedDestinationSummary"
      ( \Object
x ->
          Text
-> SuppressionListReason -> POSIX -> SuppressedDestinationSummary
SuppressedDestinationSummary'
            (Text
 -> SuppressionListReason -> POSIX -> SuppressedDestinationSummary)
-> Parser Text
-> Parser
     (SuppressionListReason -> POSIX -> SuppressedDestinationSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EmailAddress")
            Parser
  (SuppressionListReason -> POSIX -> SuppressedDestinationSummary)
-> Parser SuppressionListReason
-> Parser (POSIX -> SuppressedDestinationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SuppressionListReason
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Reason")
            Parser (POSIX -> SuppressedDestinationSummary)
-> Parser POSIX -> Parser SuppressedDestinationSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"LastUpdateTime")
      )

instance
  Prelude.Hashable
    SuppressedDestinationSummary

instance Prelude.NFData SuppressedDestinationSummary