{-# 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.SES.Types.SendDataPoint
-- 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.SES.Types.SendDataPoint 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

-- | Represents sending statistics data. Each @SendDataPoint@ contains
-- statistics for a 15-minute period of sending activity.
--
-- /See:/ 'newSendDataPoint' smart constructor.
data SendDataPoint = SendDataPoint'
  { -- | Number of emails that have bounced.
    SendDataPoint -> Maybe Integer
bounces :: Prelude.Maybe Prelude.Integer,
    -- | Number of unwanted emails that were rejected by recipients.
    SendDataPoint -> Maybe Integer
complaints :: Prelude.Maybe Prelude.Integer,
    -- | Number of emails that have been sent.
    SendDataPoint -> Maybe Integer
deliveryAttempts :: Prelude.Maybe Prelude.Integer,
    -- | Number of emails rejected by Amazon SES.
    SendDataPoint -> Maybe Integer
rejects :: Prelude.Maybe Prelude.Integer,
    -- | Time of the data point.
    SendDataPoint -> Maybe ISO8601
timestamp :: Prelude.Maybe Data.ISO8601
  }
  deriving (SendDataPoint -> SendDataPoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendDataPoint -> SendDataPoint -> Bool
$c/= :: SendDataPoint -> SendDataPoint -> Bool
== :: SendDataPoint -> SendDataPoint -> Bool
$c== :: SendDataPoint -> SendDataPoint -> Bool
Prelude.Eq, ReadPrec [SendDataPoint]
ReadPrec SendDataPoint
Int -> ReadS SendDataPoint
ReadS [SendDataPoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendDataPoint]
$creadListPrec :: ReadPrec [SendDataPoint]
readPrec :: ReadPrec SendDataPoint
$creadPrec :: ReadPrec SendDataPoint
readList :: ReadS [SendDataPoint]
$creadList :: ReadS [SendDataPoint]
readsPrec :: Int -> ReadS SendDataPoint
$creadsPrec :: Int -> ReadS SendDataPoint
Prelude.Read, Int -> SendDataPoint -> ShowS
[SendDataPoint] -> ShowS
SendDataPoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendDataPoint] -> ShowS
$cshowList :: [SendDataPoint] -> ShowS
show :: SendDataPoint -> String
$cshow :: SendDataPoint -> String
showsPrec :: Int -> SendDataPoint -> ShowS
$cshowsPrec :: Int -> SendDataPoint -> ShowS
Prelude.Show, forall x. Rep SendDataPoint x -> SendDataPoint
forall x. SendDataPoint -> Rep SendDataPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendDataPoint x -> SendDataPoint
$cfrom :: forall x. SendDataPoint -> Rep SendDataPoint x
Prelude.Generic)

-- |
-- Create a value of 'SendDataPoint' 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:
--
-- 'bounces', 'sendDataPoint_bounces' - Number of emails that have bounced.
--
-- 'complaints', 'sendDataPoint_complaints' - Number of unwanted emails that were rejected by recipients.
--
-- 'deliveryAttempts', 'sendDataPoint_deliveryAttempts' - Number of emails that have been sent.
--
-- 'rejects', 'sendDataPoint_rejects' - Number of emails rejected by Amazon SES.
--
-- 'timestamp', 'sendDataPoint_timestamp' - Time of the data point.
newSendDataPoint ::
  SendDataPoint
newSendDataPoint :: SendDataPoint
newSendDataPoint =
  SendDataPoint'
    { $sel:bounces:SendDataPoint' :: Maybe Integer
bounces = forall a. Maybe a
Prelude.Nothing,
      $sel:complaints:SendDataPoint' :: Maybe Integer
complaints = forall a. Maybe a
Prelude.Nothing,
      $sel:deliveryAttempts:SendDataPoint' :: Maybe Integer
deliveryAttempts = forall a. Maybe a
Prelude.Nothing,
      $sel:rejects:SendDataPoint' :: Maybe Integer
rejects = forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:SendDataPoint' :: Maybe ISO8601
timestamp = forall a. Maybe a
Prelude.Nothing
    }

-- | Number of emails that have bounced.
sendDataPoint_bounces :: Lens.Lens' SendDataPoint (Prelude.Maybe Prelude.Integer)
sendDataPoint_bounces :: Lens' SendDataPoint (Maybe Integer)
sendDataPoint_bounces = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendDataPoint' {Maybe Integer
bounces :: Maybe Integer
$sel:bounces:SendDataPoint' :: SendDataPoint -> Maybe Integer
bounces} -> Maybe Integer
bounces) (\s :: SendDataPoint
s@SendDataPoint' {} Maybe Integer
a -> SendDataPoint
s {$sel:bounces:SendDataPoint' :: Maybe Integer
bounces = Maybe Integer
a} :: SendDataPoint)

-- | Number of unwanted emails that were rejected by recipients.
sendDataPoint_complaints :: Lens.Lens' SendDataPoint (Prelude.Maybe Prelude.Integer)
sendDataPoint_complaints :: Lens' SendDataPoint (Maybe Integer)
sendDataPoint_complaints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendDataPoint' {Maybe Integer
complaints :: Maybe Integer
$sel:complaints:SendDataPoint' :: SendDataPoint -> Maybe Integer
complaints} -> Maybe Integer
complaints) (\s :: SendDataPoint
s@SendDataPoint' {} Maybe Integer
a -> SendDataPoint
s {$sel:complaints:SendDataPoint' :: Maybe Integer
complaints = Maybe Integer
a} :: SendDataPoint)

-- | Number of emails that have been sent.
sendDataPoint_deliveryAttempts :: Lens.Lens' SendDataPoint (Prelude.Maybe Prelude.Integer)
sendDataPoint_deliveryAttempts :: Lens' SendDataPoint (Maybe Integer)
sendDataPoint_deliveryAttempts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendDataPoint' {Maybe Integer
deliveryAttempts :: Maybe Integer
$sel:deliveryAttempts:SendDataPoint' :: SendDataPoint -> Maybe Integer
deliveryAttempts} -> Maybe Integer
deliveryAttempts) (\s :: SendDataPoint
s@SendDataPoint' {} Maybe Integer
a -> SendDataPoint
s {$sel:deliveryAttempts:SendDataPoint' :: Maybe Integer
deliveryAttempts = Maybe Integer
a} :: SendDataPoint)

-- | Number of emails rejected by Amazon SES.
sendDataPoint_rejects :: Lens.Lens' SendDataPoint (Prelude.Maybe Prelude.Integer)
sendDataPoint_rejects :: Lens' SendDataPoint (Maybe Integer)
sendDataPoint_rejects = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendDataPoint' {Maybe Integer
rejects :: Maybe Integer
$sel:rejects:SendDataPoint' :: SendDataPoint -> Maybe Integer
rejects} -> Maybe Integer
rejects) (\s :: SendDataPoint
s@SendDataPoint' {} Maybe Integer
a -> SendDataPoint
s {$sel:rejects:SendDataPoint' :: Maybe Integer
rejects = Maybe Integer
a} :: SendDataPoint)

-- | Time of the data point.
sendDataPoint_timestamp :: Lens.Lens' SendDataPoint (Prelude.Maybe Prelude.UTCTime)
sendDataPoint_timestamp :: Lens' SendDataPoint (Maybe UTCTime)
sendDataPoint_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendDataPoint' {Maybe ISO8601
timestamp :: Maybe ISO8601
$sel:timestamp:SendDataPoint' :: SendDataPoint -> Maybe ISO8601
timestamp} -> Maybe ISO8601
timestamp) (\s :: SendDataPoint
s@SendDataPoint' {} Maybe ISO8601
a -> SendDataPoint
s {$sel:timestamp:SendDataPoint' :: Maybe ISO8601
timestamp = Maybe ISO8601
a} :: SendDataPoint) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromXML SendDataPoint where
  parseXML :: [Node] -> Either String SendDataPoint
parseXML [Node]
x =
    Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe ISO8601
-> SendDataPoint
SendDataPoint'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Bounces")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Complaints")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DeliveryAttempts")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Rejects")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Timestamp")

instance Prelude.Hashable SendDataPoint where
  hashWithSalt :: Int -> SendDataPoint -> Int
hashWithSalt Int
_salt SendDataPoint' {Maybe Integer
Maybe ISO8601
timestamp :: Maybe ISO8601
rejects :: Maybe Integer
deliveryAttempts :: Maybe Integer
complaints :: Maybe Integer
bounces :: Maybe Integer
$sel:timestamp:SendDataPoint' :: SendDataPoint -> Maybe ISO8601
$sel:rejects:SendDataPoint' :: SendDataPoint -> Maybe Integer
$sel:deliveryAttempts:SendDataPoint' :: SendDataPoint -> Maybe Integer
$sel:complaints:SendDataPoint' :: SendDataPoint -> Maybe Integer
$sel:bounces:SendDataPoint' :: SendDataPoint -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
bounces
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
complaints
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
deliveryAttempts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
rejects
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
timestamp

instance Prelude.NFData SendDataPoint where
  rnf :: SendDataPoint -> ()
rnf SendDataPoint' {Maybe Integer
Maybe ISO8601
timestamp :: Maybe ISO8601
rejects :: Maybe Integer
deliveryAttempts :: Maybe Integer
complaints :: Maybe Integer
bounces :: Maybe Integer
$sel:timestamp:SendDataPoint' :: SendDataPoint -> Maybe ISO8601
$sel:rejects:SendDataPoint' :: SendDataPoint -> Maybe Integer
$sel:deliveryAttempts:SendDataPoint' :: SendDataPoint -> Maybe Integer
$sel:complaints:SendDataPoint' :: SendDataPoint -> Maybe Integer
$sel:bounces:SendDataPoint' :: SendDataPoint -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
bounces
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
complaints
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
deliveryAttempts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
rejects
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
timestamp