{-# 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.PinpointEmail.Types.DeliverabilityTestReport
-- 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.PinpointEmail.Types.DeliverabilityTestReport where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.PinpointEmail.Types.DeliverabilityTestStatus
import qualified Amazonka.Prelude as Prelude

-- | An object that contains metadata related to a predictive inbox placement
-- test.
--
-- /See:/ 'newDeliverabilityTestReport' smart constructor.
data DeliverabilityTestReport = DeliverabilityTestReport'
  { -- | The subject line for an email that you submitted in a predictive inbox
    -- placement test.
    DeliverabilityTestReport -> Maybe Text
subject :: Prelude.Maybe Prelude.Text,
    -- | The sender address that you specified for the predictive inbox placement
    -- test.
    DeliverabilityTestReport -> Maybe Text
fromEmailAddress :: Prelude.Maybe Prelude.Text,
    -- | The date and time when the predictive inbox placement test was created,
    -- in Unix time format.
    DeliverabilityTestReport -> Maybe POSIX
createDate :: Prelude.Maybe Core.POSIX,
    -- | A unique string that identifies the predictive inbox placement test.
    DeliverabilityTestReport -> Maybe Text
reportId :: Prelude.Maybe Prelude.Text,
    -- | A name that helps you identify a predictive inbox placement test report.
    DeliverabilityTestReport -> Maybe Text
reportName :: Prelude.Maybe Prelude.Text,
    -- | The status of the predictive inbox placement test. If the status is
    -- @IN_PROGRESS@, then the predictive inbox placement test is currently
    -- running. Predictive inbox placement tests are usually complete within 24
    -- hours of creating the test. If the status is @COMPLETE@, then the test
    -- is finished, and you can use the @GetDeliverabilityTestReport@ to view
    -- the results of the test.
    DeliverabilityTestReport -> Maybe DeliverabilityTestStatus
deliverabilityTestStatus :: Prelude.Maybe DeliverabilityTestStatus
  }
  deriving (DeliverabilityTestReport -> DeliverabilityTestReport -> Bool
(DeliverabilityTestReport -> DeliverabilityTestReport -> Bool)
-> (DeliverabilityTestReport -> DeliverabilityTestReport -> Bool)
-> Eq DeliverabilityTestReport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeliverabilityTestReport -> DeliverabilityTestReport -> Bool
$c/= :: DeliverabilityTestReport -> DeliverabilityTestReport -> Bool
== :: DeliverabilityTestReport -> DeliverabilityTestReport -> Bool
$c== :: DeliverabilityTestReport -> DeliverabilityTestReport -> Bool
Prelude.Eq, ReadPrec [DeliverabilityTestReport]
ReadPrec DeliverabilityTestReport
Int -> ReadS DeliverabilityTestReport
ReadS [DeliverabilityTestReport]
(Int -> ReadS DeliverabilityTestReport)
-> ReadS [DeliverabilityTestReport]
-> ReadPrec DeliverabilityTestReport
-> ReadPrec [DeliverabilityTestReport]
-> Read DeliverabilityTestReport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeliverabilityTestReport]
$creadListPrec :: ReadPrec [DeliverabilityTestReport]
readPrec :: ReadPrec DeliverabilityTestReport
$creadPrec :: ReadPrec DeliverabilityTestReport
readList :: ReadS [DeliverabilityTestReport]
$creadList :: ReadS [DeliverabilityTestReport]
readsPrec :: Int -> ReadS DeliverabilityTestReport
$creadsPrec :: Int -> ReadS DeliverabilityTestReport
Prelude.Read, Int -> DeliverabilityTestReport -> ShowS
[DeliverabilityTestReport] -> ShowS
DeliverabilityTestReport -> String
(Int -> DeliverabilityTestReport -> ShowS)
-> (DeliverabilityTestReport -> String)
-> ([DeliverabilityTestReport] -> ShowS)
-> Show DeliverabilityTestReport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeliverabilityTestReport] -> ShowS
$cshowList :: [DeliverabilityTestReport] -> ShowS
show :: DeliverabilityTestReport -> String
$cshow :: DeliverabilityTestReport -> String
showsPrec :: Int -> DeliverabilityTestReport -> ShowS
$cshowsPrec :: Int -> DeliverabilityTestReport -> ShowS
Prelude.Show, (forall x.
 DeliverabilityTestReport -> Rep DeliverabilityTestReport x)
-> (forall x.
    Rep DeliverabilityTestReport x -> DeliverabilityTestReport)
-> Generic DeliverabilityTestReport
forall x.
Rep DeliverabilityTestReport x -> DeliverabilityTestReport
forall x.
DeliverabilityTestReport -> Rep DeliverabilityTestReport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeliverabilityTestReport x -> DeliverabilityTestReport
$cfrom :: forall x.
DeliverabilityTestReport -> Rep DeliverabilityTestReport x
Prelude.Generic)

-- |
-- Create a value of 'DeliverabilityTestReport' 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:
--
-- 'subject', 'deliverabilityTestReport_subject' - The subject line for an email that you submitted in a predictive inbox
-- placement test.
--
-- 'fromEmailAddress', 'deliverabilityTestReport_fromEmailAddress' - The sender address that you specified for the predictive inbox placement
-- test.
--
-- 'createDate', 'deliverabilityTestReport_createDate' - The date and time when the predictive inbox placement test was created,
-- in Unix time format.
--
-- 'reportId', 'deliverabilityTestReport_reportId' - A unique string that identifies the predictive inbox placement test.
--
-- 'reportName', 'deliverabilityTestReport_reportName' - A name that helps you identify a predictive inbox placement test report.
--
-- 'deliverabilityTestStatus', 'deliverabilityTestReport_deliverabilityTestStatus' - The status of the predictive inbox placement test. If the status is
-- @IN_PROGRESS@, then the predictive inbox placement test is currently
-- running. Predictive inbox placement tests are usually complete within 24
-- hours of creating the test. If the status is @COMPLETE@, then the test
-- is finished, and you can use the @GetDeliverabilityTestReport@ to view
-- the results of the test.
newDeliverabilityTestReport ::
  DeliverabilityTestReport
newDeliverabilityTestReport :: DeliverabilityTestReport
newDeliverabilityTestReport =
  DeliverabilityTestReport' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe DeliverabilityTestStatus
-> DeliverabilityTestReport
DeliverabilityTestReport'
    { $sel:subject:DeliverabilityTestReport' :: Maybe Text
subject =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fromEmailAddress:DeliverabilityTestReport' :: Maybe Text
fromEmailAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createDate:DeliverabilityTestReport' :: Maybe POSIX
createDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:reportId:DeliverabilityTestReport' :: Maybe Text
reportId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reportName:DeliverabilityTestReport' :: Maybe Text
reportName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deliverabilityTestStatus:DeliverabilityTestReport' :: Maybe DeliverabilityTestStatus
deliverabilityTestStatus = Maybe DeliverabilityTestStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The subject line for an email that you submitted in a predictive inbox
-- placement test.
deliverabilityTestReport_subject :: Lens.Lens' DeliverabilityTestReport (Prelude.Maybe Prelude.Text)
deliverabilityTestReport_subject :: (Maybe Text -> f (Maybe Text))
-> DeliverabilityTestReport -> f DeliverabilityTestReport
deliverabilityTestReport_subject = (DeliverabilityTestReport -> Maybe Text)
-> (DeliverabilityTestReport
    -> Maybe Text -> DeliverabilityTestReport)
-> Lens
     DeliverabilityTestReport
     DeliverabilityTestReport
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliverabilityTestReport' {Maybe Text
subject :: Maybe Text
$sel:subject:DeliverabilityTestReport' :: DeliverabilityTestReport -> Maybe Text
subject} -> Maybe Text
subject) (\s :: DeliverabilityTestReport
s@DeliverabilityTestReport' {} Maybe Text
a -> DeliverabilityTestReport
s {$sel:subject:DeliverabilityTestReport' :: Maybe Text
subject = Maybe Text
a} :: DeliverabilityTestReport)

-- | The sender address that you specified for the predictive inbox placement
-- test.
deliverabilityTestReport_fromEmailAddress :: Lens.Lens' DeliverabilityTestReport (Prelude.Maybe Prelude.Text)
deliverabilityTestReport_fromEmailAddress :: (Maybe Text -> f (Maybe Text))
-> DeliverabilityTestReport -> f DeliverabilityTestReport
deliverabilityTestReport_fromEmailAddress = (DeliverabilityTestReport -> Maybe Text)
-> (DeliverabilityTestReport
    -> Maybe Text -> DeliverabilityTestReport)
-> Lens
     DeliverabilityTestReport
     DeliverabilityTestReport
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliverabilityTestReport' {Maybe Text
fromEmailAddress :: Maybe Text
$sel:fromEmailAddress:DeliverabilityTestReport' :: DeliverabilityTestReport -> Maybe Text
fromEmailAddress} -> Maybe Text
fromEmailAddress) (\s :: DeliverabilityTestReport
s@DeliverabilityTestReport' {} Maybe Text
a -> DeliverabilityTestReport
s {$sel:fromEmailAddress:DeliverabilityTestReport' :: Maybe Text
fromEmailAddress = Maybe Text
a} :: DeliverabilityTestReport)

-- | The date and time when the predictive inbox placement test was created,
-- in Unix time format.
deliverabilityTestReport_createDate :: Lens.Lens' DeliverabilityTestReport (Prelude.Maybe Prelude.UTCTime)
deliverabilityTestReport_createDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DeliverabilityTestReport -> f DeliverabilityTestReport
deliverabilityTestReport_createDate = (DeliverabilityTestReport -> Maybe POSIX)
-> (DeliverabilityTestReport
    -> Maybe POSIX -> DeliverabilityTestReport)
-> Lens
     DeliverabilityTestReport
     DeliverabilityTestReport
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliverabilityTestReport' {Maybe POSIX
createDate :: Maybe POSIX
$sel:createDate:DeliverabilityTestReport' :: DeliverabilityTestReport -> Maybe POSIX
createDate} -> Maybe POSIX
createDate) (\s :: DeliverabilityTestReport
s@DeliverabilityTestReport' {} Maybe POSIX
a -> DeliverabilityTestReport
s {$sel:createDate:DeliverabilityTestReport' :: Maybe POSIX
createDate = Maybe POSIX
a} :: DeliverabilityTestReport) ((Maybe POSIX -> f (Maybe POSIX))
 -> DeliverabilityTestReport -> f DeliverabilityTestReport)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DeliverabilityTestReport
-> f DeliverabilityTestReport
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

-- | A unique string that identifies the predictive inbox placement test.
deliverabilityTestReport_reportId :: Lens.Lens' DeliverabilityTestReport (Prelude.Maybe Prelude.Text)
deliverabilityTestReport_reportId :: (Maybe Text -> f (Maybe Text))
-> DeliverabilityTestReport -> f DeliverabilityTestReport
deliverabilityTestReport_reportId = (DeliverabilityTestReport -> Maybe Text)
-> (DeliverabilityTestReport
    -> Maybe Text -> DeliverabilityTestReport)
-> Lens
     DeliverabilityTestReport
     DeliverabilityTestReport
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliverabilityTestReport' {Maybe Text
reportId :: Maybe Text
$sel:reportId:DeliverabilityTestReport' :: DeliverabilityTestReport -> Maybe Text
reportId} -> Maybe Text
reportId) (\s :: DeliverabilityTestReport
s@DeliverabilityTestReport' {} Maybe Text
a -> DeliverabilityTestReport
s {$sel:reportId:DeliverabilityTestReport' :: Maybe Text
reportId = Maybe Text
a} :: DeliverabilityTestReport)

-- | A name that helps you identify a predictive inbox placement test report.
deliverabilityTestReport_reportName :: Lens.Lens' DeliverabilityTestReport (Prelude.Maybe Prelude.Text)
deliverabilityTestReport_reportName :: (Maybe Text -> f (Maybe Text))
-> DeliverabilityTestReport -> f DeliverabilityTestReport
deliverabilityTestReport_reportName = (DeliverabilityTestReport -> Maybe Text)
-> (DeliverabilityTestReport
    -> Maybe Text -> DeliverabilityTestReport)
-> Lens
     DeliverabilityTestReport
     DeliverabilityTestReport
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliverabilityTestReport' {Maybe Text
reportName :: Maybe Text
$sel:reportName:DeliverabilityTestReport' :: DeliverabilityTestReport -> Maybe Text
reportName} -> Maybe Text
reportName) (\s :: DeliverabilityTestReport
s@DeliverabilityTestReport' {} Maybe Text
a -> DeliverabilityTestReport
s {$sel:reportName:DeliverabilityTestReport' :: Maybe Text
reportName = Maybe Text
a} :: DeliverabilityTestReport)

-- | The status of the predictive inbox placement test. If the status is
-- @IN_PROGRESS@, then the predictive inbox placement test is currently
-- running. Predictive inbox placement tests are usually complete within 24
-- hours of creating the test. If the status is @COMPLETE@, then the test
-- is finished, and you can use the @GetDeliverabilityTestReport@ to view
-- the results of the test.
deliverabilityTestReport_deliverabilityTestStatus :: Lens.Lens' DeliverabilityTestReport (Prelude.Maybe DeliverabilityTestStatus)
deliverabilityTestReport_deliverabilityTestStatus :: (Maybe DeliverabilityTestStatus
 -> f (Maybe DeliverabilityTestStatus))
-> DeliverabilityTestReport -> f DeliverabilityTestReport
deliverabilityTestReport_deliverabilityTestStatus = (DeliverabilityTestReport -> Maybe DeliverabilityTestStatus)
-> (DeliverabilityTestReport
    -> Maybe DeliverabilityTestStatus -> DeliverabilityTestReport)
-> Lens
     DeliverabilityTestReport
     DeliverabilityTestReport
     (Maybe DeliverabilityTestStatus)
     (Maybe DeliverabilityTestStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliverabilityTestReport' {Maybe DeliverabilityTestStatus
deliverabilityTestStatus :: Maybe DeliverabilityTestStatus
$sel:deliverabilityTestStatus:DeliverabilityTestReport' :: DeliverabilityTestReport -> Maybe DeliverabilityTestStatus
deliverabilityTestStatus} -> Maybe DeliverabilityTestStatus
deliverabilityTestStatus) (\s :: DeliverabilityTestReport
s@DeliverabilityTestReport' {} Maybe DeliverabilityTestStatus
a -> DeliverabilityTestReport
s {$sel:deliverabilityTestStatus:DeliverabilityTestReport' :: Maybe DeliverabilityTestStatus
deliverabilityTestStatus = Maybe DeliverabilityTestStatus
a} :: DeliverabilityTestReport)

instance Core.FromJSON DeliverabilityTestReport where
  parseJSON :: Value -> Parser DeliverabilityTestReport
parseJSON =
    String
-> (Object -> Parser DeliverabilityTestReport)
-> Value
-> Parser DeliverabilityTestReport
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeliverabilityTestReport"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe DeliverabilityTestStatus
-> DeliverabilityTestReport
DeliverabilityTestReport'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe DeliverabilityTestStatus
 -> DeliverabilityTestReport)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe DeliverabilityTestStatus
      -> DeliverabilityTestReport)
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
"Subject")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe DeliverabilityTestStatus
   -> DeliverabilityTestReport)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe DeliverabilityTestStatus
      -> DeliverabilityTestReport)
forall (f :: * -> *) a b. Applicative f => 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
"FromEmailAddress")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe DeliverabilityTestStatus
   -> DeliverabilityTestReport)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe DeliverabilityTestStatus
      -> DeliverabilityTestReport)
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
"CreateDate")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe DeliverabilityTestStatus
   -> DeliverabilityTestReport)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe DeliverabilityTestStatus -> DeliverabilityTestReport)
forall (f :: * -> *) a b. Applicative f => 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
"ReportId")
            Parser
  (Maybe Text
   -> Maybe DeliverabilityTestStatus -> DeliverabilityTestReport)
-> Parser (Maybe Text)
-> Parser
     (Maybe DeliverabilityTestStatus -> DeliverabilityTestReport)
forall (f :: * -> *) a b. Applicative f => 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
"ReportName")
            Parser (Maybe DeliverabilityTestStatus -> DeliverabilityTestReport)
-> Parser (Maybe DeliverabilityTestStatus)
-> Parser DeliverabilityTestReport
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DeliverabilityTestStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeliverabilityTestStatus")
      )

instance Prelude.Hashable DeliverabilityTestReport

instance Prelude.NFData DeliverabilityTestReport