{-# 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.Translate.Types.JobDetails
-- 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.Translate.Types.JobDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The number of documents successfully and unsuccessfully processed during
-- a translation job.
--
-- /See:/ 'newJobDetails' smart constructor.
data JobDetails = JobDetails'
  { -- | The number of documents successfully processed during a translation job.
    JobDetails -> Maybe Int
translatedDocumentsCount :: Prelude.Maybe Prelude.Int,
    -- | The number of documents that could not be processed during a translation
    -- job.
    JobDetails -> Maybe Int
documentsWithErrorsCount :: Prelude.Maybe Prelude.Int,
    -- | The number of documents used as input in a translation job.
    JobDetails -> Maybe Int
inputDocumentsCount :: Prelude.Maybe Prelude.Int
  }
  deriving (JobDetails -> JobDetails -> Bool
(JobDetails -> JobDetails -> Bool)
-> (JobDetails -> JobDetails -> Bool) -> Eq JobDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobDetails -> JobDetails -> Bool
$c/= :: JobDetails -> JobDetails -> Bool
== :: JobDetails -> JobDetails -> Bool
$c== :: JobDetails -> JobDetails -> Bool
Prelude.Eq, ReadPrec [JobDetails]
ReadPrec JobDetails
Int -> ReadS JobDetails
ReadS [JobDetails]
(Int -> ReadS JobDetails)
-> ReadS [JobDetails]
-> ReadPrec JobDetails
-> ReadPrec [JobDetails]
-> Read JobDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobDetails]
$creadListPrec :: ReadPrec [JobDetails]
readPrec :: ReadPrec JobDetails
$creadPrec :: ReadPrec JobDetails
readList :: ReadS [JobDetails]
$creadList :: ReadS [JobDetails]
readsPrec :: Int -> ReadS JobDetails
$creadsPrec :: Int -> ReadS JobDetails
Prelude.Read, Int -> JobDetails -> ShowS
[JobDetails] -> ShowS
JobDetails -> String
(Int -> JobDetails -> ShowS)
-> (JobDetails -> String)
-> ([JobDetails] -> ShowS)
-> Show JobDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobDetails] -> ShowS
$cshowList :: [JobDetails] -> ShowS
show :: JobDetails -> String
$cshow :: JobDetails -> String
showsPrec :: Int -> JobDetails -> ShowS
$cshowsPrec :: Int -> JobDetails -> ShowS
Prelude.Show, (forall x. JobDetails -> Rep JobDetails x)
-> (forall x. Rep JobDetails x -> JobDetails) -> Generic JobDetails
forall x. Rep JobDetails x -> JobDetails
forall x. JobDetails -> Rep JobDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobDetails x -> JobDetails
$cfrom :: forall x. JobDetails -> Rep JobDetails x
Prelude.Generic)

-- |
-- Create a value of 'JobDetails' 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:
--
-- 'translatedDocumentsCount', 'jobDetails_translatedDocumentsCount' - The number of documents successfully processed during a translation job.
--
-- 'documentsWithErrorsCount', 'jobDetails_documentsWithErrorsCount' - The number of documents that could not be processed during a translation
-- job.
--
-- 'inputDocumentsCount', 'jobDetails_inputDocumentsCount' - The number of documents used as input in a translation job.
newJobDetails ::
  JobDetails
newJobDetails :: JobDetails
newJobDetails =
  JobDetails' :: Maybe Int -> Maybe Int -> Maybe Int -> JobDetails
JobDetails'
    { $sel:translatedDocumentsCount:JobDetails' :: Maybe Int
translatedDocumentsCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:documentsWithErrorsCount:JobDetails' :: Maybe Int
documentsWithErrorsCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:inputDocumentsCount:JobDetails' :: Maybe Int
inputDocumentsCount = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of documents successfully processed during a translation job.
jobDetails_translatedDocumentsCount :: Lens.Lens' JobDetails (Prelude.Maybe Prelude.Int)
jobDetails_translatedDocumentsCount :: (Maybe Int -> f (Maybe Int)) -> JobDetails -> f JobDetails
jobDetails_translatedDocumentsCount = (JobDetails -> Maybe Int)
-> (JobDetails -> Maybe Int -> JobDetails)
-> Lens JobDetails JobDetails (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe Int
translatedDocumentsCount :: Maybe Int
$sel:translatedDocumentsCount:JobDetails' :: JobDetails -> Maybe Int
translatedDocumentsCount} -> Maybe Int
translatedDocumentsCount) (\s :: JobDetails
s@JobDetails' {} Maybe Int
a -> JobDetails
s {$sel:translatedDocumentsCount:JobDetails' :: Maybe Int
translatedDocumentsCount = Maybe Int
a} :: JobDetails)

-- | The number of documents that could not be processed during a translation
-- job.
jobDetails_documentsWithErrorsCount :: Lens.Lens' JobDetails (Prelude.Maybe Prelude.Int)
jobDetails_documentsWithErrorsCount :: (Maybe Int -> f (Maybe Int)) -> JobDetails -> f JobDetails
jobDetails_documentsWithErrorsCount = (JobDetails -> Maybe Int)
-> (JobDetails -> Maybe Int -> JobDetails)
-> Lens JobDetails JobDetails (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe Int
documentsWithErrorsCount :: Maybe Int
$sel:documentsWithErrorsCount:JobDetails' :: JobDetails -> Maybe Int
documentsWithErrorsCount} -> Maybe Int
documentsWithErrorsCount) (\s :: JobDetails
s@JobDetails' {} Maybe Int
a -> JobDetails
s {$sel:documentsWithErrorsCount:JobDetails' :: Maybe Int
documentsWithErrorsCount = Maybe Int
a} :: JobDetails)

-- | The number of documents used as input in a translation job.
jobDetails_inputDocumentsCount :: Lens.Lens' JobDetails (Prelude.Maybe Prelude.Int)
jobDetails_inputDocumentsCount :: (Maybe Int -> f (Maybe Int)) -> JobDetails -> f JobDetails
jobDetails_inputDocumentsCount = (JobDetails -> Maybe Int)
-> (JobDetails -> Maybe Int -> JobDetails)
-> Lens JobDetails JobDetails (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe Int
inputDocumentsCount :: Maybe Int
$sel:inputDocumentsCount:JobDetails' :: JobDetails -> Maybe Int
inputDocumentsCount} -> Maybe Int
inputDocumentsCount) (\s :: JobDetails
s@JobDetails' {} Maybe Int
a -> JobDetails
s {$sel:inputDocumentsCount:JobDetails' :: Maybe Int
inputDocumentsCount = Maybe Int
a} :: JobDetails)

instance Core.FromJSON JobDetails where
  parseJSON :: Value -> Parser JobDetails
parseJSON =
    String
-> (Object -> Parser JobDetails) -> Value -> Parser JobDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobDetails"
      ( \Object
x ->
          Maybe Int -> Maybe Int -> Maybe Int -> JobDetails
JobDetails'
            (Maybe Int -> Maybe Int -> Maybe Int -> JobDetails)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Int -> JobDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TranslatedDocumentsCount")
            Parser (Maybe Int -> Maybe Int -> JobDetails)
-> Parser (Maybe Int) -> Parser (Maybe Int -> JobDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DocumentsWithErrorsCount")
            Parser (Maybe Int -> JobDetails)
-> Parser (Maybe Int) -> Parser JobDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InputDocumentsCount")
      )

instance Prelude.Hashable JobDetails

instance Prelude.NFData JobDetails