{-# 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.OverallVolume
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.PinpointEmail.Types.OverallVolume where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.PinpointEmail.Types.DomainIspPlacement
import Amazonka.PinpointEmail.Types.VolumeStatistics
import qualified Amazonka.Prelude as Prelude

-- | 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],
    -- | The percentage of emails that were sent from the domain that were read
    -- by their recipients.
    OverallVolume -> Maybe Double
readRatePercent :: Prelude.Maybe Prelude.Double,
    -- | 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
  }
  deriving (OverallVolume -> OverallVolume -> Bool
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]
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
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. 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.
--
-- 'readRatePercent', 'overallVolume_readRatePercent' - The percentage of emails that were sent from the domain that were read
-- by their recipients.
--
-- 'volumeStatistics', 'overallVolume_volumeStatistics' - An object that contains information about the numbers of messages that
-- arrived in recipients\' inboxes and junk mail folders.
newOverallVolume ::
  OverallVolume
newOverallVolume :: OverallVolume
newOverallVolume =
  OverallVolume'
    { $sel:domainIspPlacements:OverallVolume' :: Maybe [DomainIspPlacement]
domainIspPlacements =
        forall a. Maybe a
Prelude.Nothing,
      $sel:readRatePercent:OverallVolume' :: Maybe Double
readRatePercent = forall a. Maybe a
Prelude.Nothing,
      $sel:volumeStatistics:OverallVolume' :: Maybe VolumeStatistics
volumeStatistics = 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 :: Lens' OverallVolume (Maybe [DomainIspPlacement])
overallVolume_domainIspPlacements = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' OverallVolume (Maybe Double)
overallVolume_readRatePercent = 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)

-- | 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 :: Lens' OverallVolume (Maybe VolumeStatistics)
overallVolume_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)

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

instance Prelude.Hashable OverallVolume where
  hashWithSalt :: Int -> OverallVolume -> Int
hashWithSalt Int
_salt OverallVolume' {Maybe Double
Maybe [DomainIspPlacement]
Maybe VolumeStatistics
volumeStatistics :: Maybe VolumeStatistics
readRatePercent :: Maybe Double
domainIspPlacements :: Maybe [DomainIspPlacement]
$sel:volumeStatistics:OverallVolume' :: OverallVolume -> Maybe VolumeStatistics
$sel:readRatePercent:OverallVolume' :: OverallVolume -> Maybe Double
$sel:domainIspPlacements:OverallVolume' :: OverallVolume -> Maybe [DomainIspPlacement]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DomainIspPlacement]
domainIspPlacements
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
readRatePercent
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VolumeStatistics
volumeStatistics

instance Prelude.NFData OverallVolume where
  rnf :: OverallVolume -> ()
rnf OverallVolume' {Maybe Double
Maybe [DomainIspPlacement]
Maybe VolumeStatistics
volumeStatistics :: Maybe VolumeStatistics
readRatePercent :: Maybe Double
domainIspPlacements :: Maybe [DomainIspPlacement]
$sel:volumeStatistics:OverallVolume' :: OverallVolume -> Maybe VolumeStatistics
$sel:readRatePercent:OverallVolume' :: OverallVolume -> Maybe Double
$sel:domainIspPlacements:OverallVolume' :: OverallVolume -> Maybe [DomainIspPlacement]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DomainIspPlacement]
domainIspPlacements
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
readRatePercent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VolumeStatistics
volumeStatistics