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

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

-- | An object that contains information about the amount of email that was
-- delivered to recipients.
--
-- /See:/ 'newVolumeStatistics' smart constructor.
data VolumeStatistics = VolumeStatistics'
  { -- | The total number of emails that arrived in recipients\' inboxes.
    VolumeStatistics -> Maybe Integer
inboxRawCount :: Prelude.Maybe Prelude.Integer,
    -- | An estimate of the percentage of emails sent from the current domain
    -- that will arrive in recipients\' spam or junk mail folders.
    VolumeStatistics -> Maybe Integer
projectedSpam :: Prelude.Maybe Prelude.Integer,
    -- | An estimate of the percentage of emails sent from the current domain
    -- that will arrive in recipients\' inboxes.
    VolumeStatistics -> Maybe Integer
projectedInbox :: Prelude.Maybe Prelude.Integer,
    -- | The total number of emails that arrived in recipients\' spam or junk
    -- mail folders.
    VolumeStatistics -> Maybe Integer
spamRawCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (VolumeStatistics -> VolumeStatistics -> Bool
(VolumeStatistics -> VolumeStatistics -> Bool)
-> (VolumeStatistics -> VolumeStatistics -> Bool)
-> Eq VolumeStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VolumeStatistics -> VolumeStatistics -> Bool
$c/= :: VolumeStatistics -> VolumeStatistics -> Bool
== :: VolumeStatistics -> VolumeStatistics -> Bool
$c== :: VolumeStatistics -> VolumeStatistics -> Bool
Prelude.Eq, ReadPrec [VolumeStatistics]
ReadPrec VolumeStatistics
Int -> ReadS VolumeStatistics
ReadS [VolumeStatistics]
(Int -> ReadS VolumeStatistics)
-> ReadS [VolumeStatistics]
-> ReadPrec VolumeStatistics
-> ReadPrec [VolumeStatistics]
-> Read VolumeStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VolumeStatistics]
$creadListPrec :: ReadPrec [VolumeStatistics]
readPrec :: ReadPrec VolumeStatistics
$creadPrec :: ReadPrec VolumeStatistics
readList :: ReadS [VolumeStatistics]
$creadList :: ReadS [VolumeStatistics]
readsPrec :: Int -> ReadS VolumeStatistics
$creadsPrec :: Int -> ReadS VolumeStatistics
Prelude.Read, Int -> VolumeStatistics -> ShowS
[VolumeStatistics] -> ShowS
VolumeStatistics -> String
(Int -> VolumeStatistics -> ShowS)
-> (VolumeStatistics -> String)
-> ([VolumeStatistics] -> ShowS)
-> Show VolumeStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VolumeStatistics] -> ShowS
$cshowList :: [VolumeStatistics] -> ShowS
show :: VolumeStatistics -> String
$cshow :: VolumeStatistics -> String
showsPrec :: Int -> VolumeStatistics -> ShowS
$cshowsPrec :: Int -> VolumeStatistics -> ShowS
Prelude.Show, (forall x. VolumeStatistics -> Rep VolumeStatistics x)
-> (forall x. Rep VolumeStatistics x -> VolumeStatistics)
-> Generic VolumeStatistics
forall x. Rep VolumeStatistics x -> VolumeStatistics
forall x. VolumeStatistics -> Rep VolumeStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VolumeStatistics x -> VolumeStatistics
$cfrom :: forall x. VolumeStatistics -> Rep VolumeStatistics x
Prelude.Generic)

-- |
-- Create a value of 'VolumeStatistics' 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:
--
-- 'inboxRawCount', 'volumeStatistics_inboxRawCount' - The total number of emails that arrived in recipients\' inboxes.
--
-- 'projectedSpam', 'volumeStatistics_projectedSpam' - An estimate of the percentage of emails sent from the current domain
-- that will arrive in recipients\' spam or junk mail folders.
--
-- 'projectedInbox', 'volumeStatistics_projectedInbox' - An estimate of the percentage of emails sent from the current domain
-- that will arrive in recipients\' inboxes.
--
-- 'spamRawCount', 'volumeStatistics_spamRawCount' - The total number of emails that arrived in recipients\' spam or junk
-- mail folders.
newVolumeStatistics ::
  VolumeStatistics
newVolumeStatistics :: VolumeStatistics
newVolumeStatistics =
  VolumeStatistics' :: Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> VolumeStatistics
VolumeStatistics'
    { $sel:inboxRawCount:VolumeStatistics' :: Maybe Integer
inboxRawCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:projectedSpam:VolumeStatistics' :: Maybe Integer
projectedSpam = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:projectedInbox:VolumeStatistics' :: Maybe Integer
projectedInbox = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:spamRawCount:VolumeStatistics' :: Maybe Integer
spamRawCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The total number of emails that arrived in recipients\' inboxes.
volumeStatistics_inboxRawCount :: Lens.Lens' VolumeStatistics (Prelude.Maybe Prelude.Integer)
volumeStatistics_inboxRawCount :: (Maybe Integer -> f (Maybe Integer))
-> VolumeStatistics -> f VolumeStatistics
volumeStatistics_inboxRawCount = (VolumeStatistics -> Maybe Integer)
-> (VolumeStatistics -> Maybe Integer -> VolumeStatistics)
-> Lens
     VolumeStatistics VolumeStatistics (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeStatistics' {Maybe Integer
inboxRawCount :: Maybe Integer
$sel:inboxRawCount:VolumeStatistics' :: VolumeStatistics -> Maybe Integer
inboxRawCount} -> Maybe Integer
inboxRawCount) (\s :: VolumeStatistics
s@VolumeStatistics' {} Maybe Integer
a -> VolumeStatistics
s {$sel:inboxRawCount:VolumeStatistics' :: Maybe Integer
inboxRawCount = Maybe Integer
a} :: VolumeStatistics)

-- | An estimate of the percentage of emails sent from the current domain
-- that will arrive in recipients\' spam or junk mail folders.
volumeStatistics_projectedSpam :: Lens.Lens' VolumeStatistics (Prelude.Maybe Prelude.Integer)
volumeStatistics_projectedSpam :: (Maybe Integer -> f (Maybe Integer))
-> VolumeStatistics -> f VolumeStatistics
volumeStatistics_projectedSpam = (VolumeStatistics -> Maybe Integer)
-> (VolumeStatistics -> Maybe Integer -> VolumeStatistics)
-> Lens
     VolumeStatistics VolumeStatistics (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeStatistics' {Maybe Integer
projectedSpam :: Maybe Integer
$sel:projectedSpam:VolumeStatistics' :: VolumeStatistics -> Maybe Integer
projectedSpam} -> Maybe Integer
projectedSpam) (\s :: VolumeStatistics
s@VolumeStatistics' {} Maybe Integer
a -> VolumeStatistics
s {$sel:projectedSpam:VolumeStatistics' :: Maybe Integer
projectedSpam = Maybe Integer
a} :: VolumeStatistics)

-- | An estimate of the percentage of emails sent from the current domain
-- that will arrive in recipients\' inboxes.
volumeStatistics_projectedInbox :: Lens.Lens' VolumeStatistics (Prelude.Maybe Prelude.Integer)
volumeStatistics_projectedInbox :: (Maybe Integer -> f (Maybe Integer))
-> VolumeStatistics -> f VolumeStatistics
volumeStatistics_projectedInbox = (VolumeStatistics -> Maybe Integer)
-> (VolumeStatistics -> Maybe Integer -> VolumeStatistics)
-> Lens
     VolumeStatistics VolumeStatistics (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeStatistics' {Maybe Integer
projectedInbox :: Maybe Integer
$sel:projectedInbox:VolumeStatistics' :: VolumeStatistics -> Maybe Integer
projectedInbox} -> Maybe Integer
projectedInbox) (\s :: VolumeStatistics
s@VolumeStatistics' {} Maybe Integer
a -> VolumeStatistics
s {$sel:projectedInbox:VolumeStatistics' :: Maybe Integer
projectedInbox = Maybe Integer
a} :: VolumeStatistics)

-- | The total number of emails that arrived in recipients\' spam or junk
-- mail folders.
volumeStatistics_spamRawCount :: Lens.Lens' VolumeStatistics (Prelude.Maybe Prelude.Integer)
volumeStatistics_spamRawCount :: (Maybe Integer -> f (Maybe Integer))
-> VolumeStatistics -> f VolumeStatistics
volumeStatistics_spamRawCount = (VolumeStatistics -> Maybe Integer)
-> (VolumeStatistics -> Maybe Integer -> VolumeStatistics)
-> Lens
     VolumeStatistics VolumeStatistics (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeStatistics' {Maybe Integer
spamRawCount :: Maybe Integer
$sel:spamRawCount:VolumeStatistics' :: VolumeStatistics -> Maybe Integer
spamRawCount} -> Maybe Integer
spamRawCount) (\s :: VolumeStatistics
s@VolumeStatistics' {} Maybe Integer
a -> VolumeStatistics
s {$sel:spamRawCount:VolumeStatistics' :: Maybe Integer
spamRawCount = Maybe Integer
a} :: VolumeStatistics)

instance Core.FromJSON VolumeStatistics where
  parseJSON :: Value -> Parser VolumeStatistics
parseJSON =
    String
-> (Object -> Parser VolumeStatistics)
-> Value
-> Parser VolumeStatistics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VolumeStatistics"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> VolumeStatistics
VolumeStatistics'
            (Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> VolumeStatistics)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Integer -> Maybe Integer -> VolumeStatistics)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InboxRawCount")
            Parser
  (Maybe Integer
   -> Maybe Integer -> Maybe Integer -> VolumeStatistics)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> Maybe Integer -> VolumeStatistics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProjectedSpam")
            Parser (Maybe Integer -> Maybe Integer -> VolumeStatistics)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> VolumeStatistics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProjectedInbox")
            Parser (Maybe Integer -> VolumeStatistics)
-> Parser (Maybe Integer) -> Parser VolumeStatistics
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SpamRawCount")
      )

instance Prelude.Hashable VolumeStatistics

instance Prelude.NFData VolumeStatistics