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

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

-- | An object that contains inbox placement data for an email provider.
--
-- /See:/ 'newPlacementStatistics' smart constructor.
data PlacementStatistics = PlacementStatistics'
  { -- | The percentage of emails that didn\'t arrive in recipients\' inboxes at
    -- all during the predictive inbox placement test.
    PlacementStatistics -> Maybe Double
missingPercentage :: Prelude.Maybe Prelude.Double,
    -- | The percentage of emails that arrived in recipients\' spam or junk mail
    -- folders during the predictive inbox placement test.
    PlacementStatistics -> Maybe Double
spamPercentage :: Prelude.Maybe Prelude.Double,
    -- | The percentage of emails that were authenticated by using Sender Policy
    -- Framework (SPF) during the predictive inbox placement test.
    PlacementStatistics -> Maybe Double
spfPercentage :: Prelude.Maybe Prelude.Double,
    -- | The percentage of emails that were authenticated by using DomainKeys
    -- Identified Mail (DKIM) during the predictive inbox placement test.
    PlacementStatistics -> Maybe Double
dkimPercentage :: Prelude.Maybe Prelude.Double,
    -- | The percentage of emails that arrived in recipients\' inboxes during the
    -- predictive inbox placement test.
    PlacementStatistics -> Maybe Double
inboxPercentage :: Prelude.Maybe Prelude.Double
  }
  deriving (PlacementStatistics -> PlacementStatistics -> Bool
(PlacementStatistics -> PlacementStatistics -> Bool)
-> (PlacementStatistics -> PlacementStatistics -> Bool)
-> Eq PlacementStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlacementStatistics -> PlacementStatistics -> Bool
$c/= :: PlacementStatistics -> PlacementStatistics -> Bool
== :: PlacementStatistics -> PlacementStatistics -> Bool
$c== :: PlacementStatistics -> PlacementStatistics -> Bool
Prelude.Eq, ReadPrec [PlacementStatistics]
ReadPrec PlacementStatistics
Int -> ReadS PlacementStatistics
ReadS [PlacementStatistics]
(Int -> ReadS PlacementStatistics)
-> ReadS [PlacementStatistics]
-> ReadPrec PlacementStatistics
-> ReadPrec [PlacementStatistics]
-> Read PlacementStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PlacementStatistics]
$creadListPrec :: ReadPrec [PlacementStatistics]
readPrec :: ReadPrec PlacementStatistics
$creadPrec :: ReadPrec PlacementStatistics
readList :: ReadS [PlacementStatistics]
$creadList :: ReadS [PlacementStatistics]
readsPrec :: Int -> ReadS PlacementStatistics
$creadsPrec :: Int -> ReadS PlacementStatistics
Prelude.Read, Int -> PlacementStatistics -> ShowS
[PlacementStatistics] -> ShowS
PlacementStatistics -> String
(Int -> PlacementStatistics -> ShowS)
-> (PlacementStatistics -> String)
-> ([PlacementStatistics] -> ShowS)
-> Show PlacementStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlacementStatistics] -> ShowS
$cshowList :: [PlacementStatistics] -> ShowS
show :: PlacementStatistics -> String
$cshow :: PlacementStatistics -> String
showsPrec :: Int -> PlacementStatistics -> ShowS
$cshowsPrec :: Int -> PlacementStatistics -> ShowS
Prelude.Show, (forall x. PlacementStatistics -> Rep PlacementStatistics x)
-> (forall x. Rep PlacementStatistics x -> PlacementStatistics)
-> Generic PlacementStatistics
forall x. Rep PlacementStatistics x -> PlacementStatistics
forall x. PlacementStatistics -> Rep PlacementStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlacementStatistics x -> PlacementStatistics
$cfrom :: forall x. PlacementStatistics -> Rep PlacementStatistics x
Prelude.Generic)

-- |
-- Create a value of 'PlacementStatistics' 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:
--
-- 'missingPercentage', 'placementStatistics_missingPercentage' - The percentage of emails that didn\'t arrive in recipients\' inboxes at
-- all during the predictive inbox placement test.
--
-- 'spamPercentage', 'placementStatistics_spamPercentage' - The percentage of emails that arrived in recipients\' spam or junk mail
-- folders during the predictive inbox placement test.
--
-- 'spfPercentage', 'placementStatistics_spfPercentage' - The percentage of emails that were authenticated by using Sender Policy
-- Framework (SPF) during the predictive inbox placement test.
--
-- 'dkimPercentage', 'placementStatistics_dkimPercentage' - The percentage of emails that were authenticated by using DomainKeys
-- Identified Mail (DKIM) during the predictive inbox placement test.
--
-- 'inboxPercentage', 'placementStatistics_inboxPercentage' - The percentage of emails that arrived in recipients\' inboxes during the
-- predictive inbox placement test.
newPlacementStatistics ::
  PlacementStatistics
newPlacementStatistics :: PlacementStatistics
newPlacementStatistics =
  PlacementStatistics' :: Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> PlacementStatistics
PlacementStatistics'
    { $sel:missingPercentage:PlacementStatistics' :: Maybe Double
missingPercentage =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:spamPercentage:PlacementStatistics' :: Maybe Double
spamPercentage = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:spfPercentage:PlacementStatistics' :: Maybe Double
spfPercentage = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:dkimPercentage:PlacementStatistics' :: Maybe Double
dkimPercentage = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:inboxPercentage:PlacementStatistics' :: Maybe Double
inboxPercentage = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The percentage of emails that didn\'t arrive in recipients\' inboxes at
-- all during the predictive inbox placement test.
placementStatistics_missingPercentage :: Lens.Lens' PlacementStatistics (Prelude.Maybe Prelude.Double)
placementStatistics_missingPercentage :: (Maybe Double -> f (Maybe Double))
-> PlacementStatistics -> f PlacementStatistics
placementStatistics_missingPercentage = (PlacementStatistics -> Maybe Double)
-> (PlacementStatistics -> Maybe Double -> PlacementStatistics)
-> Lens
     PlacementStatistics
     PlacementStatistics
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacementStatistics' {Maybe Double
missingPercentage :: Maybe Double
$sel:missingPercentage:PlacementStatistics' :: PlacementStatistics -> Maybe Double
missingPercentage} -> Maybe Double
missingPercentage) (\s :: PlacementStatistics
s@PlacementStatistics' {} Maybe Double
a -> PlacementStatistics
s {$sel:missingPercentage:PlacementStatistics' :: Maybe Double
missingPercentage = Maybe Double
a} :: PlacementStatistics)

-- | The percentage of emails that arrived in recipients\' spam or junk mail
-- folders during the predictive inbox placement test.
placementStatistics_spamPercentage :: Lens.Lens' PlacementStatistics (Prelude.Maybe Prelude.Double)
placementStatistics_spamPercentage :: (Maybe Double -> f (Maybe Double))
-> PlacementStatistics -> f PlacementStatistics
placementStatistics_spamPercentage = (PlacementStatistics -> Maybe Double)
-> (PlacementStatistics -> Maybe Double -> PlacementStatistics)
-> Lens
     PlacementStatistics
     PlacementStatistics
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacementStatistics' {Maybe Double
spamPercentage :: Maybe Double
$sel:spamPercentage:PlacementStatistics' :: PlacementStatistics -> Maybe Double
spamPercentage} -> Maybe Double
spamPercentage) (\s :: PlacementStatistics
s@PlacementStatistics' {} Maybe Double
a -> PlacementStatistics
s {$sel:spamPercentage:PlacementStatistics' :: Maybe Double
spamPercentage = Maybe Double
a} :: PlacementStatistics)

-- | The percentage of emails that were authenticated by using Sender Policy
-- Framework (SPF) during the predictive inbox placement test.
placementStatistics_spfPercentage :: Lens.Lens' PlacementStatistics (Prelude.Maybe Prelude.Double)
placementStatistics_spfPercentage :: (Maybe Double -> f (Maybe Double))
-> PlacementStatistics -> f PlacementStatistics
placementStatistics_spfPercentage = (PlacementStatistics -> Maybe Double)
-> (PlacementStatistics -> Maybe Double -> PlacementStatistics)
-> Lens
     PlacementStatistics
     PlacementStatistics
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacementStatistics' {Maybe Double
spfPercentage :: Maybe Double
$sel:spfPercentage:PlacementStatistics' :: PlacementStatistics -> Maybe Double
spfPercentage} -> Maybe Double
spfPercentage) (\s :: PlacementStatistics
s@PlacementStatistics' {} Maybe Double
a -> PlacementStatistics
s {$sel:spfPercentage:PlacementStatistics' :: Maybe Double
spfPercentage = Maybe Double
a} :: PlacementStatistics)

-- | The percentage of emails that were authenticated by using DomainKeys
-- Identified Mail (DKIM) during the predictive inbox placement test.
placementStatistics_dkimPercentage :: Lens.Lens' PlacementStatistics (Prelude.Maybe Prelude.Double)
placementStatistics_dkimPercentage :: (Maybe Double -> f (Maybe Double))
-> PlacementStatistics -> f PlacementStatistics
placementStatistics_dkimPercentage = (PlacementStatistics -> Maybe Double)
-> (PlacementStatistics -> Maybe Double -> PlacementStatistics)
-> Lens
     PlacementStatistics
     PlacementStatistics
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacementStatistics' {Maybe Double
dkimPercentage :: Maybe Double
$sel:dkimPercentage:PlacementStatistics' :: PlacementStatistics -> Maybe Double
dkimPercentage} -> Maybe Double
dkimPercentage) (\s :: PlacementStatistics
s@PlacementStatistics' {} Maybe Double
a -> PlacementStatistics
s {$sel:dkimPercentage:PlacementStatistics' :: Maybe Double
dkimPercentage = Maybe Double
a} :: PlacementStatistics)

-- | The percentage of emails that arrived in recipients\' inboxes during the
-- predictive inbox placement test.
placementStatistics_inboxPercentage :: Lens.Lens' PlacementStatistics (Prelude.Maybe Prelude.Double)
placementStatistics_inboxPercentage :: (Maybe Double -> f (Maybe Double))
-> PlacementStatistics -> f PlacementStatistics
placementStatistics_inboxPercentage = (PlacementStatistics -> Maybe Double)
-> (PlacementStatistics -> Maybe Double -> PlacementStatistics)
-> Lens
     PlacementStatistics
     PlacementStatistics
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacementStatistics' {Maybe Double
inboxPercentage :: Maybe Double
$sel:inboxPercentage:PlacementStatistics' :: PlacementStatistics -> Maybe Double
inboxPercentage} -> Maybe Double
inboxPercentage) (\s :: PlacementStatistics
s@PlacementStatistics' {} Maybe Double
a -> PlacementStatistics
s {$sel:inboxPercentage:PlacementStatistics' :: Maybe Double
inboxPercentage = Maybe Double
a} :: PlacementStatistics)

instance Core.FromJSON PlacementStatistics where
  parseJSON :: Value -> Parser PlacementStatistics
parseJSON =
    String
-> (Object -> Parser PlacementStatistics)
-> Value
-> Parser PlacementStatistics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PlacementStatistics"
      ( \Object
x ->
          Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> PlacementStatistics
PlacementStatistics'
            (Maybe Double
 -> Maybe Double
 -> Maybe Double
 -> Maybe Double
 -> Maybe Double
 -> PlacementStatistics)
-> Parser (Maybe Double)
-> Parser
     (Maybe Double
      -> Maybe Double
      -> Maybe Double
      -> Maybe Double
      -> PlacementStatistics)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MissingPercentage")
            Parser
  (Maybe Double
   -> Maybe Double
   -> Maybe Double
   -> Maybe Double
   -> PlacementStatistics)
-> Parser (Maybe Double)
-> Parser
     (Maybe Double
      -> Maybe Double -> Maybe Double -> PlacementStatistics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SpamPercentage")
            Parser
  (Maybe Double
   -> Maybe Double -> Maybe Double -> PlacementStatistics)
-> Parser (Maybe Double)
-> Parser (Maybe Double -> Maybe Double -> PlacementStatistics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SpfPercentage")
            Parser (Maybe Double -> Maybe Double -> PlacementStatistics)
-> Parser (Maybe Double)
-> Parser (Maybe Double -> PlacementStatistics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DkimPercentage")
            Parser (Maybe Double -> PlacementStatistics)
-> Parser (Maybe Double) -> Parser PlacementStatistics
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InboxPercentage")
      )

instance Prelude.Hashable PlacementStatistics

instance Prelude.NFData PlacementStatistics