{-# 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.DomainIspPlacement
-- 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.DomainIspPlacement 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 email sent from one of
-- your email domains to a specific email provider.
--
-- /See:/ 'newDomainIspPlacement' smart constructor.
data DomainIspPlacement = DomainIspPlacement'
  { -- | The percentage of messages that were sent from the selected domain to
    -- the specified email provider that arrived in recipients\' spam or junk
    -- mail folders.
    DomainIspPlacement -> Maybe Double
spamPercentage :: Prelude.Maybe Prelude.Double,
    -- | The total number of messages that were sent from the selected domain to
    -- the specified email provider that arrived in recipients\' inboxes.
    DomainIspPlacement -> Maybe Integer
inboxRawCount :: Prelude.Maybe Prelude.Integer,
    -- | The name of the email provider that the inbox placement data applies to.
    DomainIspPlacement -> Maybe Text
ispName :: Prelude.Maybe Prelude.Text,
    -- | The percentage of messages that were sent from the selected domain to
    -- the specified email provider that arrived in recipients\' inboxes.
    DomainIspPlacement -> Maybe Double
inboxPercentage :: Prelude.Maybe Prelude.Double,
    -- | The total number of messages that were sent from the selected domain to
    -- the specified email provider that arrived in recipients\' spam or junk
    -- mail folders.
    DomainIspPlacement -> Maybe Integer
spamRawCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (DomainIspPlacement -> DomainIspPlacement -> Bool
(DomainIspPlacement -> DomainIspPlacement -> Bool)
-> (DomainIspPlacement -> DomainIspPlacement -> Bool)
-> Eq DomainIspPlacement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainIspPlacement -> DomainIspPlacement -> Bool
$c/= :: DomainIspPlacement -> DomainIspPlacement -> Bool
== :: DomainIspPlacement -> DomainIspPlacement -> Bool
$c== :: DomainIspPlacement -> DomainIspPlacement -> Bool
Prelude.Eq, ReadPrec [DomainIspPlacement]
ReadPrec DomainIspPlacement
Int -> ReadS DomainIspPlacement
ReadS [DomainIspPlacement]
(Int -> ReadS DomainIspPlacement)
-> ReadS [DomainIspPlacement]
-> ReadPrec DomainIspPlacement
-> ReadPrec [DomainIspPlacement]
-> Read DomainIspPlacement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainIspPlacement]
$creadListPrec :: ReadPrec [DomainIspPlacement]
readPrec :: ReadPrec DomainIspPlacement
$creadPrec :: ReadPrec DomainIspPlacement
readList :: ReadS [DomainIspPlacement]
$creadList :: ReadS [DomainIspPlacement]
readsPrec :: Int -> ReadS DomainIspPlacement
$creadsPrec :: Int -> ReadS DomainIspPlacement
Prelude.Read, Int -> DomainIspPlacement -> ShowS
[DomainIspPlacement] -> ShowS
DomainIspPlacement -> String
(Int -> DomainIspPlacement -> ShowS)
-> (DomainIspPlacement -> String)
-> ([DomainIspPlacement] -> ShowS)
-> Show DomainIspPlacement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainIspPlacement] -> ShowS
$cshowList :: [DomainIspPlacement] -> ShowS
show :: DomainIspPlacement -> String
$cshow :: DomainIspPlacement -> String
showsPrec :: Int -> DomainIspPlacement -> ShowS
$cshowsPrec :: Int -> DomainIspPlacement -> ShowS
Prelude.Show, (forall x. DomainIspPlacement -> Rep DomainIspPlacement x)
-> (forall x. Rep DomainIspPlacement x -> DomainIspPlacement)
-> Generic DomainIspPlacement
forall x. Rep DomainIspPlacement x -> DomainIspPlacement
forall x. DomainIspPlacement -> Rep DomainIspPlacement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainIspPlacement x -> DomainIspPlacement
$cfrom :: forall x. DomainIspPlacement -> Rep DomainIspPlacement x
Prelude.Generic)

-- |
-- Create a value of 'DomainIspPlacement' 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:
--
-- 'spamPercentage', 'domainIspPlacement_spamPercentage' - The percentage of messages that were sent from the selected domain to
-- the specified email provider that arrived in recipients\' spam or junk
-- mail folders.
--
-- 'inboxRawCount', 'domainIspPlacement_inboxRawCount' - The total number of messages that were sent from the selected domain to
-- the specified email provider that arrived in recipients\' inboxes.
--
-- 'ispName', 'domainIspPlacement_ispName' - The name of the email provider that the inbox placement data applies to.
--
-- 'inboxPercentage', 'domainIspPlacement_inboxPercentage' - The percentage of messages that were sent from the selected domain to
-- the specified email provider that arrived in recipients\' inboxes.
--
-- 'spamRawCount', 'domainIspPlacement_spamRawCount' - The total number of messages that were sent from the selected domain to
-- the specified email provider that arrived in recipients\' spam or junk
-- mail folders.
newDomainIspPlacement ::
  DomainIspPlacement
newDomainIspPlacement :: DomainIspPlacement
newDomainIspPlacement =
  DomainIspPlacement' :: Maybe Double
-> Maybe Integer
-> Maybe Text
-> Maybe Double
-> Maybe Integer
-> DomainIspPlacement
DomainIspPlacement'
    { $sel:spamPercentage:DomainIspPlacement' :: Maybe Double
spamPercentage =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:inboxRawCount:DomainIspPlacement' :: Maybe Integer
inboxRawCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:ispName:DomainIspPlacement' :: Maybe Text
ispName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inboxPercentage:DomainIspPlacement' :: Maybe Double
inboxPercentage = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:spamRawCount:DomainIspPlacement' :: Maybe Integer
spamRawCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The percentage of messages that were sent from the selected domain to
-- the specified email provider that arrived in recipients\' spam or junk
-- mail folders.
domainIspPlacement_spamPercentage :: Lens.Lens' DomainIspPlacement (Prelude.Maybe Prelude.Double)
domainIspPlacement_spamPercentage :: (Maybe Double -> f (Maybe Double))
-> DomainIspPlacement -> f DomainIspPlacement
domainIspPlacement_spamPercentage = (DomainIspPlacement -> Maybe Double)
-> (DomainIspPlacement -> Maybe Double -> DomainIspPlacement)
-> Lens
     DomainIspPlacement DomainIspPlacement (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainIspPlacement' {Maybe Double
spamPercentage :: Maybe Double
$sel:spamPercentage:DomainIspPlacement' :: DomainIspPlacement -> Maybe Double
spamPercentage} -> Maybe Double
spamPercentage) (\s :: DomainIspPlacement
s@DomainIspPlacement' {} Maybe Double
a -> DomainIspPlacement
s {$sel:spamPercentage:DomainIspPlacement' :: Maybe Double
spamPercentage = Maybe Double
a} :: DomainIspPlacement)

-- | The total number of messages that were sent from the selected domain to
-- the specified email provider that arrived in recipients\' inboxes.
domainIspPlacement_inboxRawCount :: Lens.Lens' DomainIspPlacement (Prelude.Maybe Prelude.Integer)
domainIspPlacement_inboxRawCount :: (Maybe Integer -> f (Maybe Integer))
-> DomainIspPlacement -> f DomainIspPlacement
domainIspPlacement_inboxRawCount = (DomainIspPlacement -> Maybe Integer)
-> (DomainIspPlacement -> Maybe Integer -> DomainIspPlacement)
-> Lens
     DomainIspPlacement
     DomainIspPlacement
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainIspPlacement' {Maybe Integer
inboxRawCount :: Maybe Integer
$sel:inboxRawCount:DomainIspPlacement' :: DomainIspPlacement -> Maybe Integer
inboxRawCount} -> Maybe Integer
inboxRawCount) (\s :: DomainIspPlacement
s@DomainIspPlacement' {} Maybe Integer
a -> DomainIspPlacement
s {$sel:inboxRawCount:DomainIspPlacement' :: Maybe Integer
inboxRawCount = Maybe Integer
a} :: DomainIspPlacement)

-- | The name of the email provider that the inbox placement data applies to.
domainIspPlacement_ispName :: Lens.Lens' DomainIspPlacement (Prelude.Maybe Prelude.Text)
domainIspPlacement_ispName :: (Maybe Text -> f (Maybe Text))
-> DomainIspPlacement -> f DomainIspPlacement
domainIspPlacement_ispName = (DomainIspPlacement -> Maybe Text)
-> (DomainIspPlacement -> Maybe Text -> DomainIspPlacement)
-> Lens
     DomainIspPlacement DomainIspPlacement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainIspPlacement' {Maybe Text
ispName :: Maybe Text
$sel:ispName:DomainIspPlacement' :: DomainIspPlacement -> Maybe Text
ispName} -> Maybe Text
ispName) (\s :: DomainIspPlacement
s@DomainIspPlacement' {} Maybe Text
a -> DomainIspPlacement
s {$sel:ispName:DomainIspPlacement' :: Maybe Text
ispName = Maybe Text
a} :: DomainIspPlacement)

-- | The percentage of messages that were sent from the selected domain to
-- the specified email provider that arrived in recipients\' inboxes.
domainIspPlacement_inboxPercentage :: Lens.Lens' DomainIspPlacement (Prelude.Maybe Prelude.Double)
domainIspPlacement_inboxPercentage :: (Maybe Double -> f (Maybe Double))
-> DomainIspPlacement -> f DomainIspPlacement
domainIspPlacement_inboxPercentage = (DomainIspPlacement -> Maybe Double)
-> (DomainIspPlacement -> Maybe Double -> DomainIspPlacement)
-> Lens
     DomainIspPlacement DomainIspPlacement (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainIspPlacement' {Maybe Double
inboxPercentage :: Maybe Double
$sel:inboxPercentage:DomainIspPlacement' :: DomainIspPlacement -> Maybe Double
inboxPercentage} -> Maybe Double
inboxPercentage) (\s :: DomainIspPlacement
s@DomainIspPlacement' {} Maybe Double
a -> DomainIspPlacement
s {$sel:inboxPercentage:DomainIspPlacement' :: Maybe Double
inboxPercentage = Maybe Double
a} :: DomainIspPlacement)

-- | The total number of messages that were sent from the selected domain to
-- the specified email provider that arrived in recipients\' spam or junk
-- mail folders.
domainIspPlacement_spamRawCount :: Lens.Lens' DomainIspPlacement (Prelude.Maybe Prelude.Integer)
domainIspPlacement_spamRawCount :: (Maybe Integer -> f (Maybe Integer))
-> DomainIspPlacement -> f DomainIspPlacement
domainIspPlacement_spamRawCount = (DomainIspPlacement -> Maybe Integer)
-> (DomainIspPlacement -> Maybe Integer -> DomainIspPlacement)
-> Lens
     DomainIspPlacement
     DomainIspPlacement
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainIspPlacement' {Maybe Integer
spamRawCount :: Maybe Integer
$sel:spamRawCount:DomainIspPlacement' :: DomainIspPlacement -> Maybe Integer
spamRawCount} -> Maybe Integer
spamRawCount) (\s :: DomainIspPlacement
s@DomainIspPlacement' {} Maybe Integer
a -> DomainIspPlacement
s {$sel:spamRawCount:DomainIspPlacement' :: Maybe Integer
spamRawCount = Maybe Integer
a} :: DomainIspPlacement)

instance Core.FromJSON DomainIspPlacement where
  parseJSON :: Value -> Parser DomainIspPlacement
parseJSON =
    String
-> (Object -> Parser DomainIspPlacement)
-> Value
-> Parser DomainIspPlacement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DomainIspPlacement"
      ( \Object
x ->
          Maybe Double
-> Maybe Integer
-> Maybe Text
-> Maybe Double
-> Maybe Integer
-> DomainIspPlacement
DomainIspPlacement'
            (Maybe Double
 -> Maybe Integer
 -> Maybe Text
 -> Maybe Double
 -> Maybe Integer
 -> DomainIspPlacement)
-> Parser (Maybe Double)
-> Parser
     (Maybe Integer
      -> Maybe Text
      -> Maybe Double
      -> Maybe Integer
      -> DomainIspPlacement)
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
"SpamPercentage")
            Parser
  (Maybe Integer
   -> Maybe Text
   -> Maybe Double
   -> Maybe Integer
   -> DomainIspPlacement)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Text -> Maybe Double -> Maybe Integer -> DomainIspPlacement)
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
"InboxRawCount")
            Parser
  (Maybe Text -> Maybe Double -> Maybe Integer -> DomainIspPlacement)
-> Parser (Maybe Text)
-> Parser (Maybe Double -> Maybe Integer -> DomainIspPlacement)
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
"IspName")
            Parser (Maybe Double -> Maybe Integer -> DomainIspPlacement)
-> Parser (Maybe Double)
-> Parser (Maybe Integer -> DomainIspPlacement)
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")
            Parser (Maybe Integer -> DomainIspPlacement)
-> Parser (Maybe Integer) -> Parser DomainIspPlacement
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 DomainIspPlacement

instance Prelude.NFData DomainIspPlacement