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

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

-- | An object that contains information about the Deliverability dashboard
-- subscription for a verified domain that you use to send email and
-- currently has an active Deliverability dashboard subscription. If a
-- Deliverability dashboard subscription is active for a domain, you gain
-- access to reputation, inbox placement, and other metrics for the domain.
--
-- /See:/ 'newDomainDeliverabilityTrackingOption' smart constructor.
data DomainDeliverabilityTrackingOption = DomainDeliverabilityTrackingOption'
  { -- | A verified domain that’s associated with your Amazon Web Services
    -- account and currently has an active Deliverability dashboard
    -- subscription.
    DomainDeliverabilityTrackingOption -> Maybe Text
domain :: Prelude.Maybe Prelude.Text,
    -- | The date, in Unix time format, when you enabled the Deliverability
    -- dashboard for the domain.
    DomainDeliverabilityTrackingOption -> Maybe POSIX
subscriptionStartDate :: Prelude.Maybe Core.POSIX,
    -- | An object that contains information about the inbox placement data
    -- settings for the domain.
    DomainDeliverabilityTrackingOption
-> Maybe InboxPlacementTrackingOption
inboxPlacementTrackingOption :: Prelude.Maybe InboxPlacementTrackingOption
  }
  deriving (DomainDeliverabilityTrackingOption
-> DomainDeliverabilityTrackingOption -> Bool
(DomainDeliverabilityTrackingOption
 -> DomainDeliverabilityTrackingOption -> Bool)
-> (DomainDeliverabilityTrackingOption
    -> DomainDeliverabilityTrackingOption -> Bool)
-> Eq DomainDeliverabilityTrackingOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainDeliverabilityTrackingOption
-> DomainDeliverabilityTrackingOption -> Bool
$c/= :: DomainDeliverabilityTrackingOption
-> DomainDeliverabilityTrackingOption -> Bool
== :: DomainDeliverabilityTrackingOption
-> DomainDeliverabilityTrackingOption -> Bool
$c== :: DomainDeliverabilityTrackingOption
-> DomainDeliverabilityTrackingOption -> Bool
Prelude.Eq, ReadPrec [DomainDeliverabilityTrackingOption]
ReadPrec DomainDeliverabilityTrackingOption
Int -> ReadS DomainDeliverabilityTrackingOption
ReadS [DomainDeliverabilityTrackingOption]
(Int -> ReadS DomainDeliverabilityTrackingOption)
-> ReadS [DomainDeliverabilityTrackingOption]
-> ReadPrec DomainDeliverabilityTrackingOption
-> ReadPrec [DomainDeliverabilityTrackingOption]
-> Read DomainDeliverabilityTrackingOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainDeliverabilityTrackingOption]
$creadListPrec :: ReadPrec [DomainDeliverabilityTrackingOption]
readPrec :: ReadPrec DomainDeliverabilityTrackingOption
$creadPrec :: ReadPrec DomainDeliverabilityTrackingOption
readList :: ReadS [DomainDeliverabilityTrackingOption]
$creadList :: ReadS [DomainDeliverabilityTrackingOption]
readsPrec :: Int -> ReadS DomainDeliverabilityTrackingOption
$creadsPrec :: Int -> ReadS DomainDeliverabilityTrackingOption
Prelude.Read, Int -> DomainDeliverabilityTrackingOption -> ShowS
[DomainDeliverabilityTrackingOption] -> ShowS
DomainDeliverabilityTrackingOption -> String
(Int -> DomainDeliverabilityTrackingOption -> ShowS)
-> (DomainDeliverabilityTrackingOption -> String)
-> ([DomainDeliverabilityTrackingOption] -> ShowS)
-> Show DomainDeliverabilityTrackingOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainDeliverabilityTrackingOption] -> ShowS
$cshowList :: [DomainDeliverabilityTrackingOption] -> ShowS
show :: DomainDeliverabilityTrackingOption -> String
$cshow :: DomainDeliverabilityTrackingOption -> String
showsPrec :: Int -> DomainDeliverabilityTrackingOption -> ShowS
$cshowsPrec :: Int -> DomainDeliverabilityTrackingOption -> ShowS
Prelude.Show, (forall x.
 DomainDeliverabilityTrackingOption
 -> Rep DomainDeliverabilityTrackingOption x)
-> (forall x.
    Rep DomainDeliverabilityTrackingOption x
    -> DomainDeliverabilityTrackingOption)
-> Generic DomainDeliverabilityTrackingOption
forall x.
Rep DomainDeliverabilityTrackingOption x
-> DomainDeliverabilityTrackingOption
forall x.
DomainDeliverabilityTrackingOption
-> Rep DomainDeliverabilityTrackingOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DomainDeliverabilityTrackingOption x
-> DomainDeliverabilityTrackingOption
$cfrom :: forall x.
DomainDeliverabilityTrackingOption
-> Rep DomainDeliverabilityTrackingOption x
Prelude.Generic)

-- |
-- Create a value of 'DomainDeliverabilityTrackingOption' 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:
--
-- 'domain', 'domainDeliverabilityTrackingOption_domain' - A verified domain that’s associated with your Amazon Web Services
-- account and currently has an active Deliverability dashboard
-- subscription.
--
-- 'subscriptionStartDate', 'domainDeliverabilityTrackingOption_subscriptionStartDate' - The date, in Unix time format, when you enabled the Deliverability
-- dashboard for the domain.
--
-- 'inboxPlacementTrackingOption', 'domainDeliverabilityTrackingOption_inboxPlacementTrackingOption' - An object that contains information about the inbox placement data
-- settings for the domain.
newDomainDeliverabilityTrackingOption ::
  DomainDeliverabilityTrackingOption
newDomainDeliverabilityTrackingOption :: DomainDeliverabilityTrackingOption
newDomainDeliverabilityTrackingOption =
  DomainDeliverabilityTrackingOption' :: Maybe Text
-> Maybe POSIX
-> Maybe InboxPlacementTrackingOption
-> DomainDeliverabilityTrackingOption
DomainDeliverabilityTrackingOption'
    { $sel:domain:DomainDeliverabilityTrackingOption' :: Maybe Text
domain =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subscriptionStartDate:DomainDeliverabilityTrackingOption' :: Maybe POSIX
subscriptionStartDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:inboxPlacementTrackingOption:DomainDeliverabilityTrackingOption' :: Maybe InboxPlacementTrackingOption
inboxPlacementTrackingOption =
        Maybe InboxPlacementTrackingOption
forall a. Maybe a
Prelude.Nothing
    }

-- | A verified domain that’s associated with your Amazon Web Services
-- account and currently has an active Deliverability dashboard
-- subscription.
domainDeliverabilityTrackingOption_domain :: Lens.Lens' DomainDeliverabilityTrackingOption (Prelude.Maybe Prelude.Text)
domainDeliverabilityTrackingOption_domain :: (Maybe Text -> f (Maybe Text))
-> DomainDeliverabilityTrackingOption
-> f DomainDeliverabilityTrackingOption
domainDeliverabilityTrackingOption_domain = (DomainDeliverabilityTrackingOption -> Maybe Text)
-> (DomainDeliverabilityTrackingOption
    -> Maybe Text -> DomainDeliverabilityTrackingOption)
-> Lens
     DomainDeliverabilityTrackingOption
     DomainDeliverabilityTrackingOption
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDeliverabilityTrackingOption' {Maybe Text
domain :: Maybe Text
$sel:domain:DomainDeliverabilityTrackingOption' :: DomainDeliverabilityTrackingOption -> Maybe Text
domain} -> Maybe Text
domain) (\s :: DomainDeliverabilityTrackingOption
s@DomainDeliverabilityTrackingOption' {} Maybe Text
a -> DomainDeliverabilityTrackingOption
s {$sel:domain:DomainDeliverabilityTrackingOption' :: Maybe Text
domain = Maybe Text
a} :: DomainDeliverabilityTrackingOption)

-- | The date, in Unix time format, when you enabled the Deliverability
-- dashboard for the domain.
domainDeliverabilityTrackingOption_subscriptionStartDate :: Lens.Lens' DomainDeliverabilityTrackingOption (Prelude.Maybe Prelude.UTCTime)
domainDeliverabilityTrackingOption_subscriptionStartDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DomainDeliverabilityTrackingOption
-> f DomainDeliverabilityTrackingOption
domainDeliverabilityTrackingOption_subscriptionStartDate = (DomainDeliverabilityTrackingOption -> Maybe POSIX)
-> (DomainDeliverabilityTrackingOption
    -> Maybe POSIX -> DomainDeliverabilityTrackingOption)
-> Lens
     DomainDeliverabilityTrackingOption
     DomainDeliverabilityTrackingOption
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDeliverabilityTrackingOption' {Maybe POSIX
subscriptionStartDate :: Maybe POSIX
$sel:subscriptionStartDate:DomainDeliverabilityTrackingOption' :: DomainDeliverabilityTrackingOption -> Maybe POSIX
subscriptionStartDate} -> Maybe POSIX
subscriptionStartDate) (\s :: DomainDeliverabilityTrackingOption
s@DomainDeliverabilityTrackingOption' {} Maybe POSIX
a -> DomainDeliverabilityTrackingOption
s {$sel:subscriptionStartDate:DomainDeliverabilityTrackingOption' :: Maybe POSIX
subscriptionStartDate = Maybe POSIX
a} :: DomainDeliverabilityTrackingOption) ((Maybe POSIX -> f (Maybe POSIX))
 -> DomainDeliverabilityTrackingOption
 -> f DomainDeliverabilityTrackingOption)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DomainDeliverabilityTrackingOption
-> f DomainDeliverabilityTrackingOption
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | An object that contains information about the inbox placement data
-- settings for the domain.
domainDeliverabilityTrackingOption_inboxPlacementTrackingOption :: Lens.Lens' DomainDeliverabilityTrackingOption (Prelude.Maybe InboxPlacementTrackingOption)
domainDeliverabilityTrackingOption_inboxPlacementTrackingOption :: (Maybe InboxPlacementTrackingOption
 -> f (Maybe InboxPlacementTrackingOption))
-> DomainDeliverabilityTrackingOption
-> f DomainDeliverabilityTrackingOption
domainDeliverabilityTrackingOption_inboxPlacementTrackingOption = (DomainDeliverabilityTrackingOption
 -> Maybe InboxPlacementTrackingOption)
-> (DomainDeliverabilityTrackingOption
    -> Maybe InboxPlacementTrackingOption
    -> DomainDeliverabilityTrackingOption)
-> Lens
     DomainDeliverabilityTrackingOption
     DomainDeliverabilityTrackingOption
     (Maybe InboxPlacementTrackingOption)
     (Maybe InboxPlacementTrackingOption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDeliverabilityTrackingOption' {Maybe InboxPlacementTrackingOption
inboxPlacementTrackingOption :: Maybe InboxPlacementTrackingOption
$sel:inboxPlacementTrackingOption:DomainDeliverabilityTrackingOption' :: DomainDeliverabilityTrackingOption
-> Maybe InboxPlacementTrackingOption
inboxPlacementTrackingOption} -> Maybe InboxPlacementTrackingOption
inboxPlacementTrackingOption) (\s :: DomainDeliverabilityTrackingOption
s@DomainDeliverabilityTrackingOption' {} Maybe InboxPlacementTrackingOption
a -> DomainDeliverabilityTrackingOption
s {$sel:inboxPlacementTrackingOption:DomainDeliverabilityTrackingOption' :: Maybe InboxPlacementTrackingOption
inboxPlacementTrackingOption = Maybe InboxPlacementTrackingOption
a} :: DomainDeliverabilityTrackingOption)

instance
  Core.FromJSON
    DomainDeliverabilityTrackingOption
  where
  parseJSON :: Value -> Parser DomainDeliverabilityTrackingOption
parseJSON =
    String
-> (Object -> Parser DomainDeliverabilityTrackingOption)
-> Value
-> Parser DomainDeliverabilityTrackingOption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DomainDeliverabilityTrackingOption"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe InboxPlacementTrackingOption
-> DomainDeliverabilityTrackingOption
DomainDeliverabilityTrackingOption'
            (Maybe Text
 -> Maybe POSIX
 -> Maybe InboxPlacementTrackingOption
 -> DomainDeliverabilityTrackingOption)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe InboxPlacementTrackingOption
      -> DomainDeliverabilityTrackingOption)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Domain")
            Parser
  (Maybe POSIX
   -> Maybe InboxPlacementTrackingOption
   -> DomainDeliverabilityTrackingOption)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe InboxPlacementTrackingOption
      -> DomainDeliverabilityTrackingOption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubscriptionStartDate")
            Parser
  (Maybe InboxPlacementTrackingOption
   -> DomainDeliverabilityTrackingOption)
-> Parser (Maybe InboxPlacementTrackingOption)
-> Parser DomainDeliverabilityTrackingOption
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InboxPlacementTrackingOption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InboxPlacementTrackingOption")
      )

instance
  Prelude.Hashable
    DomainDeliverabilityTrackingOption

instance
  Prelude.NFData
    DomainDeliverabilityTrackingOption

instance
  Core.ToJSON
    DomainDeliverabilityTrackingOption
  where
  toJSON :: DomainDeliverabilityTrackingOption -> Value
toJSON DomainDeliverabilityTrackingOption' {Maybe Text
Maybe POSIX
Maybe InboxPlacementTrackingOption
inboxPlacementTrackingOption :: Maybe InboxPlacementTrackingOption
subscriptionStartDate :: Maybe POSIX
domain :: Maybe Text
$sel:inboxPlacementTrackingOption:DomainDeliverabilityTrackingOption' :: DomainDeliverabilityTrackingOption
-> Maybe InboxPlacementTrackingOption
$sel:subscriptionStartDate:DomainDeliverabilityTrackingOption' :: DomainDeliverabilityTrackingOption -> Maybe POSIX
$sel:domain:DomainDeliverabilityTrackingOption' :: DomainDeliverabilityTrackingOption -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
domain,
            (Text
"SubscriptionStartDate" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
subscriptionStartDate,
            (Text
"InboxPlacementTrackingOption" Text -> InboxPlacementTrackingOption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InboxPlacementTrackingOption -> Pair)
-> Maybe InboxPlacementTrackingOption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InboxPlacementTrackingOption
inboxPlacementTrackingOption
          ]
      )