{-# 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.MacieV2.Types.Statistics
-- 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.MacieV2.Types.Statistics where

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

-- | Provides processing statistics for a classification job.
--
-- /See:/ 'newStatistics' smart constructor.
data Statistics = Statistics'
  { -- | The approximate number of objects that the job has yet to process during
    -- its current run.
    Statistics -> Maybe Double
approximateNumberOfObjectsToProcess :: Prelude.Maybe Prelude.Double,
    -- | The number of times that the job has run.
    Statistics -> Maybe Double
numberOfRuns :: Prelude.Maybe Prelude.Double
  }
  deriving (Statistics -> Statistics -> Bool
(Statistics -> Statistics -> Bool)
-> (Statistics -> Statistics -> Bool) -> Eq Statistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Statistics -> Statistics -> Bool
$c/= :: Statistics -> Statistics -> Bool
== :: Statistics -> Statistics -> Bool
$c== :: Statistics -> Statistics -> Bool
Prelude.Eq, ReadPrec [Statistics]
ReadPrec Statistics
Int -> ReadS Statistics
ReadS [Statistics]
(Int -> ReadS Statistics)
-> ReadS [Statistics]
-> ReadPrec Statistics
-> ReadPrec [Statistics]
-> Read Statistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Statistics]
$creadListPrec :: ReadPrec [Statistics]
readPrec :: ReadPrec Statistics
$creadPrec :: ReadPrec Statistics
readList :: ReadS [Statistics]
$creadList :: ReadS [Statistics]
readsPrec :: Int -> ReadS Statistics
$creadsPrec :: Int -> ReadS Statistics
Prelude.Read, Int -> Statistics -> ShowS
[Statistics] -> ShowS
Statistics -> String
(Int -> Statistics -> ShowS)
-> (Statistics -> String)
-> ([Statistics] -> ShowS)
-> Show Statistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Statistics] -> ShowS
$cshowList :: [Statistics] -> ShowS
show :: Statistics -> String
$cshow :: Statistics -> String
showsPrec :: Int -> Statistics -> ShowS
$cshowsPrec :: Int -> Statistics -> ShowS
Prelude.Show, (forall x. Statistics -> Rep Statistics x)
-> (forall x. Rep Statistics x -> Statistics) -> Generic Statistics
forall x. Rep Statistics x -> Statistics
forall x. Statistics -> Rep Statistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Statistics x -> Statistics
$cfrom :: forall x. Statistics -> Rep Statistics x
Prelude.Generic)

-- |
-- Create a value of 'Statistics' 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:
--
-- 'approximateNumberOfObjectsToProcess', 'statistics_approximateNumberOfObjectsToProcess' - The approximate number of objects that the job has yet to process during
-- its current run.
--
-- 'numberOfRuns', 'statistics_numberOfRuns' - The number of times that the job has run.
newStatistics ::
  Statistics
newStatistics :: Statistics
newStatistics =
  Statistics' :: Maybe Double -> Maybe Double -> Statistics
Statistics'
    { $sel:approximateNumberOfObjectsToProcess:Statistics' :: Maybe Double
approximateNumberOfObjectsToProcess =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfRuns:Statistics' :: Maybe Double
numberOfRuns = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The approximate number of objects that the job has yet to process during
-- its current run.
statistics_approximateNumberOfObjectsToProcess :: Lens.Lens' Statistics (Prelude.Maybe Prelude.Double)
statistics_approximateNumberOfObjectsToProcess :: (Maybe Double -> f (Maybe Double)) -> Statistics -> f Statistics
statistics_approximateNumberOfObjectsToProcess = (Statistics -> Maybe Double)
-> (Statistics -> Maybe Double -> Statistics)
-> Lens Statistics Statistics (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Statistics' {Maybe Double
approximateNumberOfObjectsToProcess :: Maybe Double
$sel:approximateNumberOfObjectsToProcess:Statistics' :: Statistics -> Maybe Double
approximateNumberOfObjectsToProcess} -> Maybe Double
approximateNumberOfObjectsToProcess) (\s :: Statistics
s@Statistics' {} Maybe Double
a -> Statistics
s {$sel:approximateNumberOfObjectsToProcess:Statistics' :: Maybe Double
approximateNumberOfObjectsToProcess = Maybe Double
a} :: Statistics)

-- | The number of times that the job has run.
statistics_numberOfRuns :: Lens.Lens' Statistics (Prelude.Maybe Prelude.Double)
statistics_numberOfRuns :: (Maybe Double -> f (Maybe Double)) -> Statistics -> f Statistics
statistics_numberOfRuns = (Statistics -> Maybe Double)
-> (Statistics -> Maybe Double -> Statistics)
-> Lens Statistics Statistics (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Statistics' {Maybe Double
numberOfRuns :: Maybe Double
$sel:numberOfRuns:Statistics' :: Statistics -> Maybe Double
numberOfRuns} -> Maybe Double
numberOfRuns) (\s :: Statistics
s@Statistics' {} Maybe Double
a -> Statistics
s {$sel:numberOfRuns:Statistics' :: Maybe Double
numberOfRuns = Maybe Double
a} :: Statistics)

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

instance Prelude.Hashable Statistics

instance Prelude.NFData Statistics