{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SWF.Types.PendingTaskCount 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

-- | 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
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]
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
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. 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'
    { $sel:truncated:PendingTaskCount' :: Maybe Bool
truncated = 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 :: Lens' PendingTaskCount (Maybe Bool)
pendingTaskCount_truncated = 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 :: Lens' PendingTaskCount Natural
pendingTaskCount_count = 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 Data.FromJSON PendingTaskCount where
  parseJSON :: Value -> Parser PendingTaskCount
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PendingTaskCount"
      ( \Object
x ->
          Maybe Bool -> Natural -> PendingTaskCount
PendingTaskCount'
            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
"truncated")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"count")
      )

instance Prelude.Hashable PendingTaskCount where
  hashWithSalt :: Int -> PendingTaskCount -> Int
hashWithSalt Int
_salt PendingTaskCount' {Natural
Maybe Bool
count :: Natural
truncated :: Maybe Bool
$sel:count:PendingTaskCount' :: PendingTaskCount -> Natural
$sel:truncated:PendingTaskCount' :: PendingTaskCount -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
truncated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
count

instance Prelude.NFData PendingTaskCount where
  rnf :: PendingTaskCount -> ()
rnf PendingTaskCount' {Natural
Maybe Bool
count :: Natural
truncated :: Maybe Bool
$sel:count:PendingTaskCount' :: PendingTaskCount -> Natural
$sel:truncated:PendingTaskCount' :: PendingTaskCount -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
truncated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
count