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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SESV2.Types.DomainIspPlacement
import Amazonka.SESV2.Types.VolumeStatistics

-- | An object that contains information about email that was sent from the
-- selected domain.
--
-- /See:/ 'newOverallVolume' smart constructor.
data OverallVolume = OverallVolume'
  { -- | An object that contains inbox and junk mail placement metrics for
    -- individual email providers.
    OverallVolume -> Maybe [DomainIspPlacement]
domainIspPlacements :: Prelude.Maybe [DomainIspPlacement],
    -- | An object that contains information about the numbers of messages that
    -- arrived in recipients\' inboxes and junk mail folders.
    OverallVolume -> Maybe VolumeStatistics
volumeStatistics :: Prelude.Maybe VolumeStatistics,
    -- | The percentage of emails that were sent from the domain that were read
    -- by their recipients.
    OverallVolume -> Maybe Double
readRatePercent :: Prelude.Maybe Prelude.Double
  }
  deriving (OverallVolume -> OverallVolume -> Bool
(OverallVolume -> OverallVolume -> Bool)
-> (OverallVolume -> OverallVolume -> Bool) -> Eq OverallVolume
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OverallVolume -> OverallVolume -> Bool
$c/= :: OverallVolume -> OverallVolume -> Bool
== :: OverallVolume -> OverallVolume -> Bool
$c== :: OverallVolume -> OverallVolume -> Bool
Prelude.Eq, ReadPrec [OverallVolume]
ReadPrec OverallVolume
Int -> ReadS OverallVolume
ReadS [OverallVolume]
(Int -> ReadS OverallVolume)
-> ReadS [OverallVolume]
-> ReadPrec OverallVolume
-> ReadPrec [OverallVolume]
-> Read OverallVolume
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OverallVolume]
$creadListPrec :: ReadPrec [OverallVolume]
readPrec :: ReadPrec OverallVolume
$creadPrec :: ReadPrec OverallVolume
readList :: ReadS [OverallVolume]
$creadList :: ReadS [OverallVolume]
readsPrec :: Int -> ReadS OverallVolume
$creadsPrec :: Int -> ReadS OverallVolume
Prelude.Read, Int -> OverallVolume -> ShowS
[OverallVolume] -> ShowS
OverallVolume -> String
(Int -> OverallVolume -> ShowS)
-> (OverallVolume -> String)
-> ([OverallVolume] -> ShowS)
-> Show OverallVolume
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OverallVolume] -> ShowS
$cshowList :: [OverallVolume] -> ShowS
show :: OverallVolume -> String
$cshow :: OverallVolume -> String
showsPrec :: Int -> OverallVolume -> ShowS
$cshowsPrec :: Int -> OverallVolume -> ShowS
Prelude.Show, (forall x. OverallVolume -> Rep OverallVolume x)
-> (forall x. Rep OverallVolume x -> OverallVolume)
-> Generic OverallVolume
forall x. Rep OverallVolume x -> OverallVolume
forall x. OverallVolume -> Rep OverallVolume x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OverallVolume x -> OverallVolume
$cfrom :: forall x. OverallVolume -> Rep OverallVolume x
Prelude.Generic)

-- |
-- Create a value of 'OverallVolume' 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:
--
-- 'domainIspPlacements', 'overallVolume_domainIspPlacements' - An object that contains inbox and junk mail placement metrics for
-- individual email providers.
--
-- 'volumeStatistics', 'overallVolume_volumeStatistics' - An object that contains information about the numbers of messages that
-- arrived in recipients\' inboxes and junk mail folders.
--
-- 'readRatePercent', 'overallVolume_readRatePercent' - The percentage of emails that were sent from the domain that were read
-- by their recipients.
newOverallVolume ::
  OverallVolume
newOverallVolume :: OverallVolume
newOverallVolume =
  OverallVolume' :: Maybe [DomainIspPlacement]
-> Maybe VolumeStatistics -> Maybe Double -> OverallVolume
OverallVolume'
    { $sel:domainIspPlacements:OverallVolume' :: Maybe [DomainIspPlacement]
domainIspPlacements =
        Maybe [DomainIspPlacement]
forall a. Maybe a
Prelude.Nothing,
      $sel:volumeStatistics:OverallVolume' :: Maybe VolumeStatistics
volumeStatistics = Maybe VolumeStatistics
forall a. Maybe a
Prelude.Nothing,
      $sel:readRatePercent:OverallVolume' :: Maybe Double
readRatePercent = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | An object that contains inbox and junk mail placement metrics for
-- individual email providers.
overallVolume_domainIspPlacements :: Lens.Lens' OverallVolume (Prelude.Maybe [DomainIspPlacement])
overallVolume_domainIspPlacements :: (Maybe [DomainIspPlacement] -> f (Maybe [DomainIspPlacement]))
-> OverallVolume -> f OverallVolume
overallVolume_domainIspPlacements = (OverallVolume -> Maybe [DomainIspPlacement])
-> (OverallVolume -> Maybe [DomainIspPlacement] -> OverallVolume)
-> Lens
     OverallVolume
     OverallVolume
     (Maybe [DomainIspPlacement])
     (Maybe [DomainIspPlacement])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OverallVolume' {Maybe [DomainIspPlacement]
domainIspPlacements :: Maybe [DomainIspPlacement]
$sel:domainIspPlacements:OverallVolume' :: OverallVolume -> Maybe [DomainIspPlacement]
domainIspPlacements} -> Maybe [DomainIspPlacement]
domainIspPlacements) (\s :: OverallVolume
s@OverallVolume' {} Maybe [DomainIspPlacement]
a -> OverallVolume
s {$sel:domainIspPlacements:OverallVolume' :: Maybe [DomainIspPlacement]
domainIspPlacements = Maybe [DomainIspPlacement]
a} :: OverallVolume) ((Maybe [DomainIspPlacement] -> f (Maybe [DomainIspPlacement]))
 -> OverallVolume -> f OverallVolume)
-> ((Maybe [DomainIspPlacement] -> f (Maybe [DomainIspPlacement]))
    -> Maybe [DomainIspPlacement] -> f (Maybe [DomainIspPlacement]))
-> (Maybe [DomainIspPlacement] -> f (Maybe [DomainIspPlacement]))
-> OverallVolume
-> f OverallVolume
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DomainIspPlacement]
  [DomainIspPlacement]
  [DomainIspPlacement]
  [DomainIspPlacement]
-> Iso
     (Maybe [DomainIspPlacement])
     (Maybe [DomainIspPlacement])
     (Maybe [DomainIspPlacement])
     (Maybe [DomainIspPlacement])
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
  [DomainIspPlacement]
  [DomainIspPlacement]
  [DomainIspPlacement]
  [DomainIspPlacement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An object that contains information about the numbers of messages that
-- arrived in recipients\' inboxes and junk mail folders.
overallVolume_volumeStatistics :: Lens.Lens' OverallVolume (Prelude.Maybe VolumeStatistics)
overallVolume_volumeStatistics :: (Maybe VolumeStatistics -> f (Maybe VolumeStatistics))
-> OverallVolume -> f OverallVolume
overallVolume_volumeStatistics = (OverallVolume -> Maybe VolumeStatistics)
-> (OverallVolume -> Maybe VolumeStatistics -> OverallVolume)
-> Lens
     OverallVolume
     OverallVolume
     (Maybe VolumeStatistics)
     (Maybe VolumeStatistics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OverallVolume' {Maybe VolumeStatistics
volumeStatistics :: Maybe VolumeStatistics
$sel:volumeStatistics:OverallVolume' :: OverallVolume -> Maybe VolumeStatistics
volumeStatistics} -> Maybe VolumeStatistics
volumeStatistics) (\s :: OverallVolume
s@OverallVolume' {} Maybe VolumeStatistics
a -> OverallVolume
s {$sel:volumeStatistics:OverallVolume' :: Maybe VolumeStatistics
volumeStatistics = Maybe VolumeStatistics
a} :: OverallVolume)

-- | The percentage of emails that were sent from the domain that were read
-- by their recipients.
overallVolume_readRatePercent :: Lens.Lens' OverallVolume (Prelude.Maybe Prelude.Double)
overallVolume_readRatePercent :: (Maybe Double -> f (Maybe Double))
-> OverallVolume -> f OverallVolume
overallVolume_readRatePercent = (OverallVolume -> Maybe Double)
-> (OverallVolume -> Maybe Double -> OverallVolume)
-> Lens OverallVolume OverallVolume (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OverallVolume' {Maybe Double
readRatePercent :: Maybe Double
$sel:readRatePercent:OverallVolume' :: OverallVolume -> Maybe Double
readRatePercent} -> Maybe Double
readRatePercent) (\s :: OverallVolume
s@OverallVolume' {} Maybe Double
a -> OverallVolume
s {$sel:readRatePercent:OverallVolume' :: Maybe Double
readRatePercent = Maybe Double
a} :: OverallVolume)

instance Core.FromJSON OverallVolume where
  parseJSON :: Value -> Parser OverallVolume
parseJSON =
    String
-> (Object -> Parser OverallVolume)
-> Value
-> Parser OverallVolume
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OverallVolume"
      ( \Object
x ->
          Maybe [DomainIspPlacement]
-> Maybe VolumeStatistics -> Maybe Double -> OverallVolume
OverallVolume'
            (Maybe [DomainIspPlacement]
 -> Maybe VolumeStatistics -> Maybe Double -> OverallVolume)
-> Parser (Maybe [DomainIspPlacement])
-> Parser (Maybe VolumeStatistics -> Maybe Double -> OverallVolume)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [DomainIspPlacement]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DomainIspPlacements"
                            Parser (Maybe (Maybe [DomainIspPlacement]))
-> Maybe [DomainIspPlacement]
-> Parser (Maybe [DomainIspPlacement])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [DomainIspPlacement]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe VolumeStatistics -> Maybe Double -> OverallVolume)
-> Parser (Maybe VolumeStatistics)
-> Parser (Maybe Double -> OverallVolume)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VolumeStatistics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VolumeStatistics")
            Parser (Maybe Double -> OverallVolume)
-> Parser (Maybe Double) -> Parser OverallVolume
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
"ReadRatePercent")
      )

instance Prelude.Hashable OverallVolume

instance Prelude.NFData OverallVolume