{-# 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.SES.Types.ReputationOptions
-- 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.SES.Types.ReputationOptions where

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

-- | Contains information about the reputation settings for a configuration
-- set.
--
-- /See:/ 'newReputationOptions' smart constructor.
data ReputationOptions = ReputationOptions'
  { -- | The date and time at which the reputation metrics for the configuration
    -- set were last reset. Resetting these metrics is known as a /fresh
    -- start/.
    --
    -- When you disable email sending for a configuration set using
    -- UpdateConfigurationSetSendingEnabled and later re-enable it, the
    -- reputation metrics for the configuration set (but not for the entire
    -- Amazon SES account) are reset.
    --
    -- If email sending for the configuration set has never been disabled and
    -- later re-enabled, the value of this attribute is @null@.
    ReputationOptions -> Maybe ISO8601
lastFreshStart :: Prelude.Maybe Core.ISO8601,
    -- | Describes whether or not Amazon SES publishes reputation metrics for the
    -- configuration set, such as bounce and complaint rates, to Amazon
    -- CloudWatch.
    --
    -- If the value is @true@, reputation metrics are published. If the value
    -- is @false@, reputation metrics are not published. The default value is
    -- @false@.
    ReputationOptions -> Maybe Bool
reputationMetricsEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Describes whether email sending is enabled or disabled for the
    -- configuration set. If the value is @true@, then Amazon SES will send
    -- emails that use the configuration set. If the value is @false@, Amazon
    -- SES will not send emails that use the configuration set. The default
    -- value is @true@. You can change this setting using
    -- UpdateConfigurationSetSendingEnabled.
    ReputationOptions -> Maybe Bool
sendingEnabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (ReputationOptions -> ReputationOptions -> Bool
(ReputationOptions -> ReputationOptions -> Bool)
-> (ReputationOptions -> ReputationOptions -> Bool)
-> Eq ReputationOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReputationOptions -> ReputationOptions -> Bool
$c/= :: ReputationOptions -> ReputationOptions -> Bool
== :: ReputationOptions -> ReputationOptions -> Bool
$c== :: ReputationOptions -> ReputationOptions -> Bool
Prelude.Eq, ReadPrec [ReputationOptions]
ReadPrec ReputationOptions
Int -> ReadS ReputationOptions
ReadS [ReputationOptions]
(Int -> ReadS ReputationOptions)
-> ReadS [ReputationOptions]
-> ReadPrec ReputationOptions
-> ReadPrec [ReputationOptions]
-> Read ReputationOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReputationOptions]
$creadListPrec :: ReadPrec [ReputationOptions]
readPrec :: ReadPrec ReputationOptions
$creadPrec :: ReadPrec ReputationOptions
readList :: ReadS [ReputationOptions]
$creadList :: ReadS [ReputationOptions]
readsPrec :: Int -> ReadS ReputationOptions
$creadsPrec :: Int -> ReadS ReputationOptions
Prelude.Read, Int -> ReputationOptions -> ShowS
[ReputationOptions] -> ShowS
ReputationOptions -> String
(Int -> ReputationOptions -> ShowS)
-> (ReputationOptions -> String)
-> ([ReputationOptions] -> ShowS)
-> Show ReputationOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReputationOptions] -> ShowS
$cshowList :: [ReputationOptions] -> ShowS
show :: ReputationOptions -> String
$cshow :: ReputationOptions -> String
showsPrec :: Int -> ReputationOptions -> ShowS
$cshowsPrec :: Int -> ReputationOptions -> ShowS
Prelude.Show, (forall x. ReputationOptions -> Rep ReputationOptions x)
-> (forall x. Rep ReputationOptions x -> ReputationOptions)
-> Generic ReputationOptions
forall x. Rep ReputationOptions x -> ReputationOptions
forall x. ReputationOptions -> Rep ReputationOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReputationOptions x -> ReputationOptions
$cfrom :: forall x. ReputationOptions -> Rep ReputationOptions x
Prelude.Generic)

-- |
-- Create a value of 'ReputationOptions' 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:
--
-- 'lastFreshStart', 'reputationOptions_lastFreshStart' - The date and time at which the reputation metrics for the configuration
-- set were last reset. Resetting these metrics is known as a /fresh
-- start/.
--
-- When you disable email sending for a configuration set using
-- UpdateConfigurationSetSendingEnabled and later re-enable it, the
-- reputation metrics for the configuration set (but not for the entire
-- Amazon SES account) are reset.
--
-- If email sending for the configuration set has never been disabled and
-- later re-enabled, the value of this attribute is @null@.
--
-- 'reputationMetricsEnabled', 'reputationOptions_reputationMetricsEnabled' - Describes whether or not Amazon SES publishes reputation metrics for the
-- configuration set, such as bounce and complaint rates, to Amazon
-- CloudWatch.
--
-- If the value is @true@, reputation metrics are published. If the value
-- is @false@, reputation metrics are not published. The default value is
-- @false@.
--
-- 'sendingEnabled', 'reputationOptions_sendingEnabled' - Describes whether email sending is enabled or disabled for the
-- configuration set. If the value is @true@, then Amazon SES will send
-- emails that use the configuration set. If the value is @false@, Amazon
-- SES will not send emails that use the configuration set. The default
-- value is @true@. You can change this setting using
-- UpdateConfigurationSetSendingEnabled.
newReputationOptions ::
  ReputationOptions
newReputationOptions :: ReputationOptions
newReputationOptions =
  ReputationOptions' :: Maybe ISO8601 -> Maybe Bool -> Maybe Bool -> ReputationOptions
ReputationOptions'
    { $sel:lastFreshStart:ReputationOptions' :: Maybe ISO8601
lastFreshStart =
        Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:reputationMetricsEnabled:ReputationOptions' :: Maybe Bool
reputationMetricsEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:sendingEnabled:ReputationOptions' :: Maybe Bool
sendingEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time at which the reputation metrics for the configuration
-- set were last reset. Resetting these metrics is known as a /fresh
-- start/.
--
-- When you disable email sending for a configuration set using
-- UpdateConfigurationSetSendingEnabled and later re-enable it, the
-- reputation metrics for the configuration set (but not for the entire
-- Amazon SES account) are reset.
--
-- If email sending for the configuration set has never been disabled and
-- later re-enabled, the value of this attribute is @null@.
reputationOptions_lastFreshStart :: Lens.Lens' ReputationOptions (Prelude.Maybe Prelude.UTCTime)
reputationOptions_lastFreshStart :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReputationOptions -> f ReputationOptions
reputationOptions_lastFreshStart = (ReputationOptions -> Maybe ISO8601)
-> (ReputationOptions -> Maybe ISO8601 -> ReputationOptions)
-> Lens
     ReputationOptions ReputationOptions (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReputationOptions' {Maybe ISO8601
lastFreshStart :: Maybe ISO8601
$sel:lastFreshStart:ReputationOptions' :: ReputationOptions -> Maybe ISO8601
lastFreshStart} -> Maybe ISO8601
lastFreshStart) (\s :: ReputationOptions
s@ReputationOptions' {} Maybe ISO8601
a -> ReputationOptions
s {$sel:lastFreshStart:ReputationOptions' :: Maybe ISO8601
lastFreshStart = Maybe ISO8601
a} :: ReputationOptions) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> ReputationOptions -> f ReputationOptions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReputationOptions
-> f ReputationOptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Describes whether or not Amazon SES publishes reputation metrics for the
-- configuration set, such as bounce and complaint rates, to Amazon
-- CloudWatch.
--
-- If the value is @true@, reputation metrics are published. If the value
-- is @false@, reputation metrics are not published. The default value is
-- @false@.
reputationOptions_reputationMetricsEnabled :: Lens.Lens' ReputationOptions (Prelude.Maybe Prelude.Bool)
reputationOptions_reputationMetricsEnabled :: (Maybe Bool -> f (Maybe Bool))
-> ReputationOptions -> f ReputationOptions
reputationOptions_reputationMetricsEnabled = (ReputationOptions -> Maybe Bool)
-> (ReputationOptions -> Maybe Bool -> ReputationOptions)
-> Lens
     ReputationOptions ReputationOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReputationOptions' {Maybe Bool
reputationMetricsEnabled :: Maybe Bool
$sel:reputationMetricsEnabled:ReputationOptions' :: ReputationOptions -> Maybe Bool
reputationMetricsEnabled} -> Maybe Bool
reputationMetricsEnabled) (\s :: ReputationOptions
s@ReputationOptions' {} Maybe Bool
a -> ReputationOptions
s {$sel:reputationMetricsEnabled:ReputationOptions' :: Maybe Bool
reputationMetricsEnabled = Maybe Bool
a} :: ReputationOptions)

-- | Describes whether email sending is enabled or disabled for the
-- configuration set. If the value is @true@, then Amazon SES will send
-- emails that use the configuration set. If the value is @false@, Amazon
-- SES will not send emails that use the configuration set. The default
-- value is @true@. You can change this setting using
-- UpdateConfigurationSetSendingEnabled.
reputationOptions_sendingEnabled :: Lens.Lens' ReputationOptions (Prelude.Maybe Prelude.Bool)
reputationOptions_sendingEnabled :: (Maybe Bool -> f (Maybe Bool))
-> ReputationOptions -> f ReputationOptions
reputationOptions_sendingEnabled = (ReputationOptions -> Maybe Bool)
-> (ReputationOptions -> Maybe Bool -> ReputationOptions)
-> Lens
     ReputationOptions ReputationOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReputationOptions' {Maybe Bool
sendingEnabled :: Maybe Bool
$sel:sendingEnabled:ReputationOptions' :: ReputationOptions -> Maybe Bool
sendingEnabled} -> Maybe Bool
sendingEnabled) (\s :: ReputationOptions
s@ReputationOptions' {} Maybe Bool
a -> ReputationOptions
s {$sel:sendingEnabled:ReputationOptions' :: Maybe Bool
sendingEnabled = Maybe Bool
a} :: ReputationOptions)

instance Core.FromXML ReputationOptions where
  parseXML :: [Node] -> Either String ReputationOptions
parseXML [Node]
x =
    Maybe ISO8601 -> Maybe Bool -> Maybe Bool -> ReputationOptions
ReputationOptions'
      (Maybe ISO8601 -> Maybe Bool -> Maybe Bool -> ReputationOptions)
-> Either String (Maybe ISO8601)
-> Either String (Maybe Bool -> Maybe Bool -> ReputationOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LastFreshStart")
      Either String (Maybe Bool -> Maybe Bool -> ReputationOptions)
-> Either String (Maybe Bool)
-> Either String (Maybe Bool -> ReputationOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReputationMetricsEnabled")
      Either String (Maybe Bool -> ReputationOptions)
-> Either String (Maybe Bool) -> Either String ReputationOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SendingEnabled")

instance Prelude.Hashable ReputationOptions

instance Prelude.NFData ReputationOptions