{-# 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.VoiceId.Types.JobProgress
-- 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.VoiceId.Types.JobProgress where

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

-- | Indicates the completion progress for a batch job.
--
-- /See:/ 'newJobProgress' smart constructor.
data JobProgress = JobProgress'
  { -- | Shows the completed percentage of enrollment or registration requests
    -- listed in the input file.
    JobProgress -> Maybe Natural
percentComplete :: Prelude.Maybe Prelude.Natural
  }
  deriving (JobProgress -> JobProgress -> Bool
(JobProgress -> JobProgress -> Bool)
-> (JobProgress -> JobProgress -> Bool) -> Eq JobProgress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobProgress -> JobProgress -> Bool
$c/= :: JobProgress -> JobProgress -> Bool
== :: JobProgress -> JobProgress -> Bool
$c== :: JobProgress -> JobProgress -> Bool
Prelude.Eq, ReadPrec [JobProgress]
ReadPrec JobProgress
Int -> ReadS JobProgress
ReadS [JobProgress]
(Int -> ReadS JobProgress)
-> ReadS [JobProgress]
-> ReadPrec JobProgress
-> ReadPrec [JobProgress]
-> Read JobProgress
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobProgress]
$creadListPrec :: ReadPrec [JobProgress]
readPrec :: ReadPrec JobProgress
$creadPrec :: ReadPrec JobProgress
readList :: ReadS [JobProgress]
$creadList :: ReadS [JobProgress]
readsPrec :: Int -> ReadS JobProgress
$creadsPrec :: Int -> ReadS JobProgress
Prelude.Read, Int -> JobProgress -> ShowS
[JobProgress] -> ShowS
JobProgress -> String
(Int -> JobProgress -> ShowS)
-> (JobProgress -> String)
-> ([JobProgress] -> ShowS)
-> Show JobProgress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobProgress] -> ShowS
$cshowList :: [JobProgress] -> ShowS
show :: JobProgress -> String
$cshow :: JobProgress -> String
showsPrec :: Int -> JobProgress -> ShowS
$cshowsPrec :: Int -> JobProgress -> ShowS
Prelude.Show, (forall x. JobProgress -> Rep JobProgress x)
-> (forall x. Rep JobProgress x -> JobProgress)
-> Generic JobProgress
forall x. Rep JobProgress x -> JobProgress
forall x. JobProgress -> Rep JobProgress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobProgress x -> JobProgress
$cfrom :: forall x. JobProgress -> Rep JobProgress x
Prelude.Generic)

-- |
-- Create a value of 'JobProgress' 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:
--
-- 'percentComplete', 'jobProgress_percentComplete' - Shows the completed percentage of enrollment or registration requests
-- listed in the input file.
newJobProgress ::
  JobProgress
newJobProgress :: JobProgress
newJobProgress =
  JobProgress' :: Maybe Natural -> JobProgress
JobProgress' {$sel:percentComplete:JobProgress' :: Maybe Natural
percentComplete = Maybe Natural
forall a. Maybe a
Prelude.Nothing}

-- | Shows the completed percentage of enrollment or registration requests
-- listed in the input file.
jobProgress_percentComplete :: Lens.Lens' JobProgress (Prelude.Maybe Prelude.Natural)
jobProgress_percentComplete :: (Maybe Natural -> f (Maybe Natural))
-> JobProgress -> f JobProgress
jobProgress_percentComplete = (JobProgress -> Maybe Natural)
-> (JobProgress -> Maybe Natural -> JobProgress)
-> Lens JobProgress JobProgress (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobProgress' {Maybe Natural
percentComplete :: Maybe Natural
$sel:percentComplete:JobProgress' :: JobProgress -> Maybe Natural
percentComplete} -> Maybe Natural
percentComplete) (\s :: JobProgress
s@JobProgress' {} Maybe Natural
a -> JobProgress
s {$sel:percentComplete:JobProgress' :: Maybe Natural
percentComplete = Maybe Natural
a} :: JobProgress)

instance Core.FromJSON JobProgress where
  parseJSON :: Value -> Parser JobProgress
parseJSON =
    String
-> (Object -> Parser JobProgress) -> Value -> Parser JobProgress
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobProgress"
      ( \Object
x ->
          Maybe Natural -> JobProgress
JobProgress'
            (Maybe Natural -> JobProgress)
-> Parser (Maybe Natural) -> Parser JobProgress
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PercentComplete")
      )

instance Prelude.Hashable JobProgress

instance Prelude.NFData JobProgress