{-# 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.IspPlacement
-- 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.SESV2.Types.IspPlacement where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SESV2.Types.PlacementStatistics

-- | An object that describes how email sent during the predictive inbox
-- placement test was handled by a certain email provider.
--
-- /See:/ 'newIspPlacement' smart constructor.
data IspPlacement = IspPlacement'
  { -- | The name of the email provider that the inbox placement data applies to.
    IspPlacement -> Maybe Text
ispName :: Prelude.Maybe Prelude.Text,
    -- | An object that contains inbox placement metrics for a specific email
    -- provider.
    IspPlacement -> Maybe PlacementStatistics
placementStatistics :: Prelude.Maybe PlacementStatistics
  }
  deriving (IspPlacement -> IspPlacement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IspPlacement -> IspPlacement -> Bool
$c/= :: IspPlacement -> IspPlacement -> Bool
== :: IspPlacement -> IspPlacement -> Bool
$c== :: IspPlacement -> IspPlacement -> Bool
Prelude.Eq, ReadPrec [IspPlacement]
ReadPrec IspPlacement
Int -> ReadS IspPlacement
ReadS [IspPlacement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IspPlacement]
$creadListPrec :: ReadPrec [IspPlacement]
readPrec :: ReadPrec IspPlacement
$creadPrec :: ReadPrec IspPlacement
readList :: ReadS [IspPlacement]
$creadList :: ReadS [IspPlacement]
readsPrec :: Int -> ReadS IspPlacement
$creadsPrec :: Int -> ReadS IspPlacement
Prelude.Read, Int -> IspPlacement -> ShowS
[IspPlacement] -> ShowS
IspPlacement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IspPlacement] -> ShowS
$cshowList :: [IspPlacement] -> ShowS
show :: IspPlacement -> String
$cshow :: IspPlacement -> String
showsPrec :: Int -> IspPlacement -> ShowS
$cshowsPrec :: Int -> IspPlacement -> ShowS
Prelude.Show, forall x. Rep IspPlacement x -> IspPlacement
forall x. IspPlacement -> Rep IspPlacement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IspPlacement x -> IspPlacement
$cfrom :: forall x. IspPlacement -> Rep IspPlacement x
Prelude.Generic)

-- |
-- Create a value of 'IspPlacement' 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:
--
-- 'ispName', 'ispPlacement_ispName' - The name of the email provider that the inbox placement data applies to.
--
-- 'placementStatistics', 'ispPlacement_placementStatistics' - An object that contains inbox placement metrics for a specific email
-- provider.
newIspPlacement ::
  IspPlacement
newIspPlacement :: IspPlacement
newIspPlacement =
  IspPlacement'
    { $sel:ispName:IspPlacement' :: Maybe Text
ispName = forall a. Maybe a
Prelude.Nothing,
      $sel:placementStatistics:IspPlacement' :: Maybe PlacementStatistics
placementStatistics = forall a. Maybe a
Prelude.Nothing
    }

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

-- | An object that contains inbox placement metrics for a specific email
-- provider.
ispPlacement_placementStatistics :: Lens.Lens' IspPlacement (Prelude.Maybe PlacementStatistics)
ispPlacement_placementStatistics :: Lens' IspPlacement (Maybe PlacementStatistics)
ispPlacement_placementStatistics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IspPlacement' {Maybe PlacementStatistics
placementStatistics :: Maybe PlacementStatistics
$sel:placementStatistics:IspPlacement' :: IspPlacement -> Maybe PlacementStatistics
placementStatistics} -> Maybe PlacementStatistics
placementStatistics) (\s :: IspPlacement
s@IspPlacement' {} Maybe PlacementStatistics
a -> IspPlacement
s {$sel:placementStatistics:IspPlacement' :: Maybe PlacementStatistics
placementStatistics = Maybe PlacementStatistics
a} :: IspPlacement)

instance Data.FromJSON IspPlacement where
  parseJSON :: Value -> Parser IspPlacement
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IspPlacement"
      ( \Object
x ->
          Maybe Text -> Maybe PlacementStatistics -> IspPlacement
IspPlacement'
            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
"IspName")
            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
"PlacementStatistics")
      )

instance Prelude.Hashable IspPlacement where
  hashWithSalt :: Int -> IspPlacement -> Int
hashWithSalt Int
_salt IspPlacement' {Maybe Text
Maybe PlacementStatistics
placementStatistics :: Maybe PlacementStatistics
ispName :: Maybe Text
$sel:placementStatistics:IspPlacement' :: IspPlacement -> Maybe PlacementStatistics
$sel:ispName:IspPlacement' :: IspPlacement -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ispName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PlacementStatistics
placementStatistics

instance Prelude.NFData IspPlacement where
  rnf :: IspPlacement -> ()
rnf IspPlacement' {Maybe Text
Maybe PlacementStatistics
placementStatistics :: Maybe PlacementStatistics
ispName :: Maybe Text
$sel:placementStatistics:IspPlacement' :: IspPlacement -> Maybe PlacementStatistics
$sel:ispName:IspPlacement' :: IspPlacement -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ispName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PlacementStatistics
placementStatistics