{-# 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.ImportJobSummary
-- 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.ImportJobSummary 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.ImportDestination
import Amazonka.SESV2.Types.JobStatus

-- | A summary of the import job.
--
-- /See:/ 'newImportJobSummary' smart constructor.
data ImportJobSummary = ImportJobSummary'
  { -- | The date and time when the import job was created.
    ImportJobSummary -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The number of records that failed processing because of invalid input or
    -- other reasons.
    ImportJobSummary -> Maybe Int
failedRecordsCount :: Prelude.Maybe Prelude.Int,
    ImportJobSummary -> Maybe ImportDestination
importDestination :: Prelude.Maybe ImportDestination,
    ImportJobSummary -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    ImportJobSummary -> Maybe JobStatus
jobStatus :: Prelude.Maybe JobStatus,
    -- | The current number of records processed.
    ImportJobSummary -> Maybe Int
processedRecordsCount :: Prelude.Maybe Prelude.Int
  }
  deriving (ImportJobSummary -> ImportJobSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportJobSummary -> ImportJobSummary -> Bool
$c/= :: ImportJobSummary -> ImportJobSummary -> Bool
== :: ImportJobSummary -> ImportJobSummary -> Bool
$c== :: ImportJobSummary -> ImportJobSummary -> Bool
Prelude.Eq, ReadPrec [ImportJobSummary]
ReadPrec ImportJobSummary
Int -> ReadS ImportJobSummary
ReadS [ImportJobSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportJobSummary]
$creadListPrec :: ReadPrec [ImportJobSummary]
readPrec :: ReadPrec ImportJobSummary
$creadPrec :: ReadPrec ImportJobSummary
readList :: ReadS [ImportJobSummary]
$creadList :: ReadS [ImportJobSummary]
readsPrec :: Int -> ReadS ImportJobSummary
$creadsPrec :: Int -> ReadS ImportJobSummary
Prelude.Read, Int -> ImportJobSummary -> ShowS
[ImportJobSummary] -> ShowS
ImportJobSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportJobSummary] -> ShowS
$cshowList :: [ImportJobSummary] -> ShowS
show :: ImportJobSummary -> String
$cshow :: ImportJobSummary -> String
showsPrec :: Int -> ImportJobSummary -> ShowS
$cshowsPrec :: Int -> ImportJobSummary -> ShowS
Prelude.Show, forall x. Rep ImportJobSummary x -> ImportJobSummary
forall x. ImportJobSummary -> Rep ImportJobSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportJobSummary x -> ImportJobSummary
$cfrom :: forall x. ImportJobSummary -> Rep ImportJobSummary x
Prelude.Generic)

-- |
-- Create a value of 'ImportJobSummary' 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:
--
-- 'createdTimestamp', 'importJobSummary_createdTimestamp' - The date and time when the import job was created.
--
-- 'failedRecordsCount', 'importJobSummary_failedRecordsCount' - The number of records that failed processing because of invalid input or
-- other reasons.
--
-- 'importDestination', 'importJobSummary_importDestination' - Undocumented member.
--
-- 'jobId', 'importJobSummary_jobId' - Undocumented member.
--
-- 'jobStatus', 'importJobSummary_jobStatus' - Undocumented member.
--
-- 'processedRecordsCount', 'importJobSummary_processedRecordsCount' - The current number of records processed.
newImportJobSummary ::
  ImportJobSummary
newImportJobSummary :: ImportJobSummary
newImportJobSummary =
  ImportJobSummary'
    { $sel:createdTimestamp:ImportJobSummary' :: Maybe POSIX
createdTimestamp =
        forall a. Maybe a
Prelude.Nothing,
      $sel:failedRecordsCount:ImportJobSummary' :: Maybe Int
failedRecordsCount = forall a. Maybe a
Prelude.Nothing,
      $sel:importDestination:ImportJobSummary' :: Maybe ImportDestination
importDestination = forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:ImportJobSummary' :: Maybe Text
jobId = forall a. Maybe a
Prelude.Nothing,
      $sel:jobStatus:ImportJobSummary' :: Maybe JobStatus
jobStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:processedRecordsCount:ImportJobSummary' :: Maybe Int
processedRecordsCount = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time when the import job was created.
importJobSummary_createdTimestamp :: Lens.Lens' ImportJobSummary (Prelude.Maybe Prelude.UTCTime)
importJobSummary_createdTimestamp :: Lens' ImportJobSummary (Maybe UTCTime)
importJobSummary_createdTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportJobSummary' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:ImportJobSummary' :: ImportJobSummary -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: ImportJobSummary
s@ImportJobSummary' {} Maybe POSIX
a -> ImportJobSummary
s {$sel:createdTimestamp:ImportJobSummary' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: ImportJobSummary) 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

-- | The number of records that failed processing because of invalid input or
-- other reasons.
importJobSummary_failedRecordsCount :: Lens.Lens' ImportJobSummary (Prelude.Maybe Prelude.Int)
importJobSummary_failedRecordsCount :: Lens' ImportJobSummary (Maybe Int)
importJobSummary_failedRecordsCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportJobSummary' {Maybe Int
failedRecordsCount :: Maybe Int
$sel:failedRecordsCount:ImportJobSummary' :: ImportJobSummary -> Maybe Int
failedRecordsCount} -> Maybe Int
failedRecordsCount) (\s :: ImportJobSummary
s@ImportJobSummary' {} Maybe Int
a -> ImportJobSummary
s {$sel:failedRecordsCount:ImportJobSummary' :: Maybe Int
failedRecordsCount = Maybe Int
a} :: ImportJobSummary)

-- | Undocumented member.
importJobSummary_importDestination :: Lens.Lens' ImportJobSummary (Prelude.Maybe ImportDestination)
importJobSummary_importDestination :: Lens' ImportJobSummary (Maybe ImportDestination)
importJobSummary_importDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportJobSummary' {Maybe ImportDestination
importDestination :: Maybe ImportDestination
$sel:importDestination:ImportJobSummary' :: ImportJobSummary -> Maybe ImportDestination
importDestination} -> Maybe ImportDestination
importDestination) (\s :: ImportJobSummary
s@ImportJobSummary' {} Maybe ImportDestination
a -> ImportJobSummary
s {$sel:importDestination:ImportJobSummary' :: Maybe ImportDestination
importDestination = Maybe ImportDestination
a} :: ImportJobSummary)

-- | Undocumented member.
importJobSummary_jobId :: Lens.Lens' ImportJobSummary (Prelude.Maybe Prelude.Text)
importJobSummary_jobId :: Lens' ImportJobSummary (Maybe Text)
importJobSummary_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportJobSummary' {Maybe Text
jobId :: Maybe Text
$sel:jobId:ImportJobSummary' :: ImportJobSummary -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: ImportJobSummary
s@ImportJobSummary' {} Maybe Text
a -> ImportJobSummary
s {$sel:jobId:ImportJobSummary' :: Maybe Text
jobId = Maybe Text
a} :: ImportJobSummary)

-- | Undocumented member.
importJobSummary_jobStatus :: Lens.Lens' ImportJobSummary (Prelude.Maybe JobStatus)
importJobSummary_jobStatus :: Lens' ImportJobSummary (Maybe JobStatus)
importJobSummary_jobStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportJobSummary' {Maybe JobStatus
jobStatus :: Maybe JobStatus
$sel:jobStatus:ImportJobSummary' :: ImportJobSummary -> Maybe JobStatus
jobStatus} -> Maybe JobStatus
jobStatus) (\s :: ImportJobSummary
s@ImportJobSummary' {} Maybe JobStatus
a -> ImportJobSummary
s {$sel:jobStatus:ImportJobSummary' :: Maybe JobStatus
jobStatus = Maybe JobStatus
a} :: ImportJobSummary)

-- | The current number of records processed.
importJobSummary_processedRecordsCount :: Lens.Lens' ImportJobSummary (Prelude.Maybe Prelude.Int)
importJobSummary_processedRecordsCount :: Lens' ImportJobSummary (Maybe Int)
importJobSummary_processedRecordsCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportJobSummary' {Maybe Int
processedRecordsCount :: Maybe Int
$sel:processedRecordsCount:ImportJobSummary' :: ImportJobSummary -> Maybe Int
processedRecordsCount} -> Maybe Int
processedRecordsCount) (\s :: ImportJobSummary
s@ImportJobSummary' {} Maybe Int
a -> ImportJobSummary
s {$sel:processedRecordsCount:ImportJobSummary' :: Maybe Int
processedRecordsCount = Maybe Int
a} :: ImportJobSummary)

instance Data.FromJSON ImportJobSummary where
  parseJSON :: Value -> Parser ImportJobSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ImportJobSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Int
-> Maybe ImportDestination
-> Maybe Text
-> Maybe JobStatus
-> Maybe Int
-> ImportJobSummary
ImportJobSummary'
            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
"CreatedTimestamp")
            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
"FailedRecordsCount")
            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
"ImportDestination")
            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
"JobId")
            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
"JobStatus")
            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
"ProcessedRecordsCount")
      )

instance Prelude.Hashable ImportJobSummary where
  hashWithSalt :: Int -> ImportJobSummary -> Int
hashWithSalt Int
_salt ImportJobSummary' {Maybe Int
Maybe Text
Maybe POSIX
Maybe JobStatus
Maybe ImportDestination
processedRecordsCount :: Maybe Int
jobStatus :: Maybe JobStatus
jobId :: Maybe Text
importDestination :: Maybe ImportDestination
failedRecordsCount :: Maybe Int
createdTimestamp :: Maybe POSIX
$sel:processedRecordsCount:ImportJobSummary' :: ImportJobSummary -> Maybe Int
$sel:jobStatus:ImportJobSummary' :: ImportJobSummary -> Maybe JobStatus
$sel:jobId:ImportJobSummary' :: ImportJobSummary -> Maybe Text
$sel:importDestination:ImportJobSummary' :: ImportJobSummary -> Maybe ImportDestination
$sel:failedRecordsCount:ImportJobSummary' :: ImportJobSummary -> Maybe Int
$sel:createdTimestamp:ImportJobSummary' :: ImportJobSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
failedRecordsCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ImportDestination
importDestination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JobStatus
jobStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
processedRecordsCount

instance Prelude.NFData ImportJobSummary where
  rnf :: ImportJobSummary -> ()
rnf ImportJobSummary' {Maybe Int
Maybe Text
Maybe POSIX
Maybe JobStatus
Maybe ImportDestination
processedRecordsCount :: Maybe Int
jobStatus :: Maybe JobStatus
jobId :: Maybe Text
importDestination :: Maybe ImportDestination
failedRecordsCount :: Maybe Int
createdTimestamp :: Maybe POSIX
$sel:processedRecordsCount:ImportJobSummary' :: ImportJobSummary -> Maybe Int
$sel:jobStatus:ImportJobSummary' :: ImportJobSummary -> Maybe JobStatus
$sel:jobId:ImportJobSummary' :: ImportJobSummary -> Maybe Text
$sel:importDestination:ImportJobSummary' :: ImportJobSummary -> Maybe ImportDestination
$sel:failedRecordsCount:ImportJobSummary' :: ImportJobSummary -> Maybe Int
$sel:createdTimestamp:ImportJobSummary' :: ImportJobSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
failedRecordsCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ImportDestination
importDestination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe JobStatus
jobStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
processedRecordsCount