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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | An object that contains inbox placement metrics for a specific email
    -- provider.
    IspPlacement -> Maybe PlacementStatistics
placementStatistics :: Prelude.Maybe PlacementStatistics,
    -- | The name of the email provider that the inbox placement data applies to.
    IspPlacement -> Maybe Text
ispName :: Prelude.Maybe Prelude.Text
  }
  deriving (IspPlacement -> IspPlacement -> Bool
(IspPlacement -> IspPlacement -> Bool)
-> (IspPlacement -> IspPlacement -> Bool) -> Eq IspPlacement
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]
(Int -> ReadS IspPlacement)
-> ReadS [IspPlacement]
-> ReadPrec IspPlacement
-> ReadPrec [IspPlacement]
-> Read 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
(Int -> IspPlacement -> ShowS)
-> (IspPlacement -> String)
-> ([IspPlacement] -> ShowS)
-> Show IspPlacement
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. IspPlacement -> Rep IspPlacement x)
-> (forall x. Rep IspPlacement x -> IspPlacement)
-> Generic IspPlacement
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:
--
-- 'placementStatistics', 'ispPlacement_placementStatistics' - An object that contains inbox placement metrics for a specific email
-- provider.
--
-- 'ispName', 'ispPlacement_ispName' - The name of the email provider that the inbox placement data applies to.
newIspPlacement ::
  IspPlacement
newIspPlacement :: IspPlacement
newIspPlacement =
  IspPlacement' :: Maybe PlacementStatistics -> Maybe Text -> IspPlacement
IspPlacement'
    { $sel:placementStatistics:IspPlacement' :: Maybe PlacementStatistics
placementStatistics =
        Maybe PlacementStatistics
forall a. Maybe a
Prelude.Nothing,
      $sel:ispName:IspPlacement' :: Maybe Text
ispName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | An object that contains inbox placement metrics for a specific email
-- provider.
ispPlacement_placementStatistics :: Lens.Lens' IspPlacement (Prelude.Maybe PlacementStatistics)
ispPlacement_placementStatistics :: (Maybe PlacementStatistics -> f (Maybe PlacementStatistics))
-> IspPlacement -> f IspPlacement
ispPlacement_placementStatistics = (IspPlacement -> Maybe PlacementStatistics)
-> (IspPlacement -> Maybe PlacementStatistics -> IspPlacement)
-> Lens
     IspPlacement
     IspPlacement
     (Maybe PlacementStatistics)
     (Maybe 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)

-- | The name of the email provider that the inbox placement data applies to.
ispPlacement_ispName :: Lens.Lens' IspPlacement (Prelude.Maybe Prelude.Text)
ispPlacement_ispName :: (Maybe Text -> f (Maybe Text)) -> IspPlacement -> f IspPlacement
ispPlacement_ispName = (IspPlacement -> Maybe Text)
-> (IspPlacement -> Maybe Text -> IspPlacement)
-> Lens IspPlacement IspPlacement (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON IspPlacement where
  parseJSON :: Value -> Parser IspPlacement
parseJSON =
    String
-> (Object -> Parser IspPlacement) -> Value -> Parser IspPlacement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IspPlacement"
      ( \Object
x ->
          Maybe PlacementStatistics -> Maybe Text -> IspPlacement
IspPlacement'
            (Maybe PlacementStatistics -> Maybe Text -> IspPlacement)
-> Parser (Maybe PlacementStatistics)
-> Parser (Maybe Text -> IspPlacement)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PlacementStatistics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PlacementStatistics")
            Parser (Maybe Text -> IspPlacement)
-> Parser (Maybe Text) -> Parser IspPlacement
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")
      )

instance Prelude.Hashable IspPlacement

instance Prelude.NFData IspPlacement