{-# 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.SWF.Types.PendingTaskCount
-- 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.SWF.Types.PendingTaskCount where

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

-- | Contains the count of tasks in a task list.
--
-- /See:/ 'newPendingTaskCount' smart constructor.
data PendingTaskCount = PendingTaskCount'
  { -- | If set to true, indicates that the actual count was more than the
    -- maximum supported by this API and the count returned is the truncated
    -- value.
    PendingTaskCount -> Maybe Bool
truncated :: Prelude.Maybe Prelude.Bool,
    -- | The number of tasks in the task list.
    PendingTaskCount -> Natural
count :: Prelude.Natural
  }
  deriving (PendingTaskCount -> PendingTaskCount -> Bool
(PendingTaskCount -> PendingTaskCount -> Bool)
-> (PendingTaskCount -> PendingTaskCount -> Bool)
-> Eq PendingTaskCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PendingTaskCount -> PendingTaskCount -> Bool
$c/= :: PendingTaskCount -> PendingTaskCount -> Bool
== :: PendingTaskCount -> PendingTaskCount -> Bool
$c== :: PendingTaskCount -> PendingTaskCount -> Bool
Prelude.Eq, ReadPrec [PendingTaskCount]
ReadPrec PendingTaskCount
Int -> ReadS PendingTaskCount
ReadS [PendingTaskCount]
(Int -> ReadS PendingTaskCount)
-> ReadS [PendingTaskCount]
-> ReadPrec PendingTaskCount
-> ReadPrec [PendingTaskCount]
-> Read PendingTaskCount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PendingTaskCount]
$creadListPrec :: ReadPrec [PendingTaskCount]
readPrec :: ReadPrec PendingTaskCount
$creadPrec :: ReadPrec PendingTaskCount
readList :: ReadS [PendingTaskCount]
$creadList :: ReadS [PendingTaskCount]
readsPrec :: Int -> ReadS PendingTaskCount
$creadsPrec :: Int -> ReadS PendingTaskCount
Prelude.Read, Int -> PendingTaskCount -> ShowS
[PendingTaskCount] -> ShowS
PendingTaskCount -> String
(Int -> PendingTaskCount -> ShowS)
-> (PendingTaskCount -> String)
-> ([PendingTaskCount] -> ShowS)
-> Show PendingTaskCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PendingTaskCount] -> ShowS
$cshowList :: [PendingTaskCount] -> ShowS
show :: PendingTaskCount -> String
$cshow :: PendingTaskCount -> String
showsPrec :: Int -> PendingTaskCount -> ShowS
$cshowsPrec :: Int -> PendingTaskCount -> ShowS
Prelude.Show, (forall x. PendingTaskCount -> Rep PendingTaskCount x)
-> (forall x. Rep PendingTaskCount x -> PendingTaskCount)
-> Generic PendingTaskCount
forall x. Rep PendingTaskCount x -> PendingTaskCount
forall x. PendingTaskCount -> Rep PendingTaskCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PendingTaskCount x -> PendingTaskCount
$cfrom :: forall x. PendingTaskCount -> Rep PendingTaskCount x
Prelude.Generic)

-- |
-- Create a value of 'PendingTaskCount' 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:
--
-- 'truncated', 'pendingTaskCount_truncated' - If set to true, indicates that the actual count was more than the
-- maximum supported by this API and the count returned is the truncated
-- value.
--
-- 'count', 'pendingTaskCount_count' - The number of tasks in the task list.
newPendingTaskCount ::
  -- | 'count'
  Prelude.Natural ->
  PendingTaskCount
newPendingTaskCount :: Natural -> PendingTaskCount
newPendingTaskCount Natural
pCount_ =
  PendingTaskCount' :: Maybe Bool -> Natural -> PendingTaskCount
PendingTaskCount'
    { $sel:truncated:PendingTaskCount' :: Maybe Bool
truncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:count:PendingTaskCount' :: Natural
count = Natural
pCount_
    }

-- | If set to true, indicates that the actual count was more than the
-- maximum supported by this API and the count returned is the truncated
-- value.
pendingTaskCount_truncated :: Lens.Lens' PendingTaskCount (Prelude.Maybe Prelude.Bool)
pendingTaskCount_truncated :: (Maybe Bool -> f (Maybe Bool))
-> PendingTaskCount -> f PendingTaskCount
pendingTaskCount_truncated = (PendingTaskCount -> Maybe Bool)
-> (PendingTaskCount -> Maybe Bool -> PendingTaskCount)
-> Lens PendingTaskCount PendingTaskCount (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingTaskCount' {Maybe Bool
truncated :: Maybe Bool
$sel:truncated:PendingTaskCount' :: PendingTaskCount -> Maybe Bool
truncated} -> Maybe Bool
truncated) (\s :: PendingTaskCount
s@PendingTaskCount' {} Maybe Bool
a -> PendingTaskCount
s {$sel:truncated:PendingTaskCount' :: Maybe Bool
truncated = Maybe Bool
a} :: PendingTaskCount)

-- | The number of tasks in the task list.
pendingTaskCount_count :: Lens.Lens' PendingTaskCount Prelude.Natural
pendingTaskCount_count :: (Natural -> f Natural) -> PendingTaskCount -> f PendingTaskCount
pendingTaskCount_count = (PendingTaskCount -> Natural)
-> (PendingTaskCount -> Natural -> PendingTaskCount)
-> Lens PendingTaskCount PendingTaskCount Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingTaskCount' {Natural
count :: Natural
$sel:count:PendingTaskCount' :: PendingTaskCount -> Natural
count} -> Natural
count) (\s :: PendingTaskCount
s@PendingTaskCount' {} Natural
a -> PendingTaskCount
s {$sel:count:PendingTaskCount' :: Natural
count = Natural
a} :: PendingTaskCount)

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

instance Prelude.Hashable PendingTaskCount

instance Prelude.NFData PendingTaskCount