{-# 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.WorkflowExecutionOpenCounts
-- 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.WorkflowExecutionOpenCounts 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 counts of open tasks, child workflow executions and timers
-- for a workflow execution.
--
-- /See:/ 'newWorkflowExecutionOpenCounts' smart constructor.
data WorkflowExecutionOpenCounts = WorkflowExecutionOpenCounts'
  { -- | The count of Lambda tasks whose status is @OPEN@.
    WorkflowExecutionOpenCounts -> Maybe Natural
openLambdaFunctions :: Prelude.Maybe Prelude.Natural,
    -- | The count of activity tasks whose status is @OPEN@.
    WorkflowExecutionOpenCounts -> Natural
openActivityTasks :: Prelude.Natural,
    -- | The count of decision tasks whose status is OPEN. A workflow execution
    -- can have at most one open decision task.
    WorkflowExecutionOpenCounts -> Natural
openDecisionTasks :: Prelude.Natural,
    -- | The count of timers started by this workflow execution that have not
    -- fired yet.
    WorkflowExecutionOpenCounts -> Natural
openTimers :: Prelude.Natural,
    -- | The count of child workflow executions whose status is @OPEN@.
    WorkflowExecutionOpenCounts -> Natural
openChildWorkflowExecutions :: Prelude.Natural
  }
  deriving (WorkflowExecutionOpenCounts -> WorkflowExecutionOpenCounts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowExecutionOpenCounts -> WorkflowExecutionOpenCounts -> Bool
$c/= :: WorkflowExecutionOpenCounts -> WorkflowExecutionOpenCounts -> Bool
== :: WorkflowExecutionOpenCounts -> WorkflowExecutionOpenCounts -> Bool
$c== :: WorkflowExecutionOpenCounts -> WorkflowExecutionOpenCounts -> Bool
Prelude.Eq, ReadPrec [WorkflowExecutionOpenCounts]
ReadPrec WorkflowExecutionOpenCounts
Int -> ReadS WorkflowExecutionOpenCounts
ReadS [WorkflowExecutionOpenCounts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowExecutionOpenCounts]
$creadListPrec :: ReadPrec [WorkflowExecutionOpenCounts]
readPrec :: ReadPrec WorkflowExecutionOpenCounts
$creadPrec :: ReadPrec WorkflowExecutionOpenCounts
readList :: ReadS [WorkflowExecutionOpenCounts]
$creadList :: ReadS [WorkflowExecutionOpenCounts]
readsPrec :: Int -> ReadS WorkflowExecutionOpenCounts
$creadsPrec :: Int -> ReadS WorkflowExecutionOpenCounts
Prelude.Read, Int -> WorkflowExecutionOpenCounts -> ShowS
[WorkflowExecutionOpenCounts] -> ShowS
WorkflowExecutionOpenCounts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowExecutionOpenCounts] -> ShowS
$cshowList :: [WorkflowExecutionOpenCounts] -> ShowS
show :: WorkflowExecutionOpenCounts -> String
$cshow :: WorkflowExecutionOpenCounts -> String
showsPrec :: Int -> WorkflowExecutionOpenCounts -> ShowS
$cshowsPrec :: Int -> WorkflowExecutionOpenCounts -> ShowS
Prelude.Show, forall x.
Rep WorkflowExecutionOpenCounts x -> WorkflowExecutionOpenCounts
forall x.
WorkflowExecutionOpenCounts -> Rep WorkflowExecutionOpenCounts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkflowExecutionOpenCounts x -> WorkflowExecutionOpenCounts
$cfrom :: forall x.
WorkflowExecutionOpenCounts -> Rep WorkflowExecutionOpenCounts x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowExecutionOpenCounts' 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:
--
-- 'openLambdaFunctions', 'workflowExecutionOpenCounts_openLambdaFunctions' - The count of Lambda tasks whose status is @OPEN@.
--
-- 'openActivityTasks', 'workflowExecutionOpenCounts_openActivityTasks' - The count of activity tasks whose status is @OPEN@.
--
-- 'openDecisionTasks', 'workflowExecutionOpenCounts_openDecisionTasks' - The count of decision tasks whose status is OPEN. A workflow execution
-- can have at most one open decision task.
--
-- 'openTimers', 'workflowExecutionOpenCounts_openTimers' - The count of timers started by this workflow execution that have not
-- fired yet.
--
-- 'openChildWorkflowExecutions', 'workflowExecutionOpenCounts_openChildWorkflowExecutions' - The count of child workflow executions whose status is @OPEN@.
newWorkflowExecutionOpenCounts ::
  -- | 'openActivityTasks'
  Prelude.Natural ->
  -- | 'openDecisionTasks'
  Prelude.Natural ->
  -- | 'openTimers'
  Prelude.Natural ->
  -- | 'openChildWorkflowExecutions'
  Prelude.Natural ->
  WorkflowExecutionOpenCounts
newWorkflowExecutionOpenCounts :: Natural
-> Natural -> Natural -> Natural -> WorkflowExecutionOpenCounts
newWorkflowExecutionOpenCounts
  Natural
pOpenActivityTasks_
  Natural
pOpenDecisionTasks_
  Natural
pOpenTimers_
  Natural
pOpenChildWorkflowExecutions_ =
    WorkflowExecutionOpenCounts'
      { $sel:openLambdaFunctions:WorkflowExecutionOpenCounts' :: Maybe Natural
openLambdaFunctions =
          forall a. Maybe a
Prelude.Nothing,
        $sel:openActivityTasks:WorkflowExecutionOpenCounts' :: Natural
openActivityTasks = Natural
pOpenActivityTasks_,
        $sel:openDecisionTasks:WorkflowExecutionOpenCounts' :: Natural
openDecisionTasks = Natural
pOpenDecisionTasks_,
        $sel:openTimers:WorkflowExecutionOpenCounts' :: Natural
openTimers = Natural
pOpenTimers_,
        $sel:openChildWorkflowExecutions:WorkflowExecutionOpenCounts' :: Natural
openChildWorkflowExecutions =
          Natural
pOpenChildWorkflowExecutions_
      }

-- | The count of Lambda tasks whose status is @OPEN@.
workflowExecutionOpenCounts_openLambdaFunctions :: Lens.Lens' WorkflowExecutionOpenCounts (Prelude.Maybe Prelude.Natural)
workflowExecutionOpenCounts_openLambdaFunctions :: Lens' WorkflowExecutionOpenCounts (Maybe Natural)
workflowExecutionOpenCounts_openLambdaFunctions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionOpenCounts' {Maybe Natural
openLambdaFunctions :: Maybe Natural
$sel:openLambdaFunctions:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Maybe Natural
openLambdaFunctions} -> Maybe Natural
openLambdaFunctions) (\s :: WorkflowExecutionOpenCounts
s@WorkflowExecutionOpenCounts' {} Maybe Natural
a -> WorkflowExecutionOpenCounts
s {$sel:openLambdaFunctions:WorkflowExecutionOpenCounts' :: Maybe Natural
openLambdaFunctions = Maybe Natural
a} :: WorkflowExecutionOpenCounts)

-- | The count of activity tasks whose status is @OPEN@.
workflowExecutionOpenCounts_openActivityTasks :: Lens.Lens' WorkflowExecutionOpenCounts Prelude.Natural
workflowExecutionOpenCounts_openActivityTasks :: Lens' WorkflowExecutionOpenCounts Natural
workflowExecutionOpenCounts_openActivityTasks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionOpenCounts' {Natural
openActivityTasks :: Natural
$sel:openActivityTasks:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
openActivityTasks} -> Natural
openActivityTasks) (\s :: WorkflowExecutionOpenCounts
s@WorkflowExecutionOpenCounts' {} Natural
a -> WorkflowExecutionOpenCounts
s {$sel:openActivityTasks:WorkflowExecutionOpenCounts' :: Natural
openActivityTasks = Natural
a} :: WorkflowExecutionOpenCounts)

-- | The count of decision tasks whose status is OPEN. A workflow execution
-- can have at most one open decision task.
workflowExecutionOpenCounts_openDecisionTasks :: Lens.Lens' WorkflowExecutionOpenCounts Prelude.Natural
workflowExecutionOpenCounts_openDecisionTasks :: Lens' WorkflowExecutionOpenCounts Natural
workflowExecutionOpenCounts_openDecisionTasks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionOpenCounts' {Natural
openDecisionTasks :: Natural
$sel:openDecisionTasks:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
openDecisionTasks} -> Natural
openDecisionTasks) (\s :: WorkflowExecutionOpenCounts
s@WorkflowExecutionOpenCounts' {} Natural
a -> WorkflowExecutionOpenCounts
s {$sel:openDecisionTasks:WorkflowExecutionOpenCounts' :: Natural
openDecisionTasks = Natural
a} :: WorkflowExecutionOpenCounts)

-- | The count of timers started by this workflow execution that have not
-- fired yet.
workflowExecutionOpenCounts_openTimers :: Lens.Lens' WorkflowExecutionOpenCounts Prelude.Natural
workflowExecutionOpenCounts_openTimers :: Lens' WorkflowExecutionOpenCounts Natural
workflowExecutionOpenCounts_openTimers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionOpenCounts' {Natural
openTimers :: Natural
$sel:openTimers:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
openTimers} -> Natural
openTimers) (\s :: WorkflowExecutionOpenCounts
s@WorkflowExecutionOpenCounts' {} Natural
a -> WorkflowExecutionOpenCounts
s {$sel:openTimers:WorkflowExecutionOpenCounts' :: Natural
openTimers = Natural
a} :: WorkflowExecutionOpenCounts)

-- | The count of child workflow executions whose status is @OPEN@.
workflowExecutionOpenCounts_openChildWorkflowExecutions :: Lens.Lens' WorkflowExecutionOpenCounts Prelude.Natural
workflowExecutionOpenCounts_openChildWorkflowExecutions :: Lens' WorkflowExecutionOpenCounts Natural
workflowExecutionOpenCounts_openChildWorkflowExecutions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionOpenCounts' {Natural
openChildWorkflowExecutions :: Natural
$sel:openChildWorkflowExecutions:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
openChildWorkflowExecutions} -> Natural
openChildWorkflowExecutions) (\s :: WorkflowExecutionOpenCounts
s@WorkflowExecutionOpenCounts' {} Natural
a -> WorkflowExecutionOpenCounts
s {$sel:openChildWorkflowExecutions:WorkflowExecutionOpenCounts' :: Natural
openChildWorkflowExecutions = Natural
a} :: WorkflowExecutionOpenCounts)

instance Data.FromJSON WorkflowExecutionOpenCounts where
  parseJSON :: Value -> Parser WorkflowExecutionOpenCounts
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkflowExecutionOpenCounts"
      ( \Object
x ->
          Maybe Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> WorkflowExecutionOpenCounts
WorkflowExecutionOpenCounts'
            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
"openLambdaFunctions")
            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
"openActivityTasks")
            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
"openDecisionTasks")
            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
"openTimers")
            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
"openChildWorkflowExecutions")
      )

instance Prelude.Hashable WorkflowExecutionOpenCounts where
  hashWithSalt :: Int -> WorkflowExecutionOpenCounts -> Int
hashWithSalt Int
_salt WorkflowExecutionOpenCounts' {Natural
Maybe Natural
openChildWorkflowExecutions :: Natural
openTimers :: Natural
openDecisionTasks :: Natural
openActivityTasks :: Natural
openLambdaFunctions :: Maybe Natural
$sel:openChildWorkflowExecutions:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
$sel:openTimers:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
$sel:openDecisionTasks:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
$sel:openActivityTasks:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
$sel:openLambdaFunctions:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
openLambdaFunctions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
openActivityTasks
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
openDecisionTasks
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
openTimers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
openChildWorkflowExecutions

instance Prelude.NFData WorkflowExecutionOpenCounts where
  rnf :: WorkflowExecutionOpenCounts -> ()
rnf WorkflowExecutionOpenCounts' {Natural
Maybe Natural
openChildWorkflowExecutions :: Natural
openTimers :: Natural
openDecisionTasks :: Natural
openActivityTasks :: Natural
openLambdaFunctions :: Maybe Natural
$sel:openChildWorkflowExecutions:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
$sel:openTimers:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
$sel:openDecisionTasks:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
$sel:openActivityTasks:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Natural
$sel:openLambdaFunctions:WorkflowExecutionOpenCounts' :: WorkflowExecutionOpenCounts -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
openLambdaFunctions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
openActivityTasks
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
openDecisionTasks
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
openTimers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
openChildWorkflowExecutions