{-# 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-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.WorkflowExecutionOpenCounts where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(WorkflowExecutionOpenCounts
 -> WorkflowExecutionOpenCounts -> Bool)
-> (WorkflowExecutionOpenCounts
    -> WorkflowExecutionOpenCounts -> Bool)
-> Eq WorkflowExecutionOpenCounts
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]
(Int -> ReadS WorkflowExecutionOpenCounts)
-> ReadS [WorkflowExecutionOpenCounts]
-> ReadPrec WorkflowExecutionOpenCounts
-> ReadPrec [WorkflowExecutionOpenCounts]
-> Read 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
(Int -> WorkflowExecutionOpenCounts -> ShowS)
-> (WorkflowExecutionOpenCounts -> String)
-> ([WorkflowExecutionOpenCounts] -> ShowS)
-> Show WorkflowExecutionOpenCounts
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.
 WorkflowExecutionOpenCounts -> Rep WorkflowExecutionOpenCounts x)
-> (forall x.
    Rep WorkflowExecutionOpenCounts x -> WorkflowExecutionOpenCounts)
-> Generic WorkflowExecutionOpenCounts
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' :: Maybe Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> WorkflowExecutionOpenCounts
WorkflowExecutionOpenCounts'
      { $sel:openLambdaFunctions:WorkflowExecutionOpenCounts' :: Maybe Natural
openLambdaFunctions =
          Maybe Natural
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 :: (Maybe Natural -> f (Maybe Natural))
-> WorkflowExecutionOpenCounts -> f WorkflowExecutionOpenCounts
workflowExecutionOpenCounts_openLambdaFunctions = (WorkflowExecutionOpenCounts -> Maybe Natural)
-> (WorkflowExecutionOpenCounts
    -> Maybe Natural -> WorkflowExecutionOpenCounts)
-> Lens
     WorkflowExecutionOpenCounts
     WorkflowExecutionOpenCounts
     (Maybe Natural)
     (Maybe Natural)
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 :: (Natural -> f Natural)
-> WorkflowExecutionOpenCounts -> f WorkflowExecutionOpenCounts
workflowExecutionOpenCounts_openActivityTasks = (WorkflowExecutionOpenCounts -> Natural)
-> (WorkflowExecutionOpenCounts
    -> Natural -> WorkflowExecutionOpenCounts)
-> Lens
     WorkflowExecutionOpenCounts
     WorkflowExecutionOpenCounts
     Natural
     Natural
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 :: (Natural -> f Natural)
-> WorkflowExecutionOpenCounts -> f WorkflowExecutionOpenCounts
workflowExecutionOpenCounts_openDecisionTasks = (WorkflowExecutionOpenCounts -> Natural)
-> (WorkflowExecutionOpenCounts
    -> Natural -> WorkflowExecutionOpenCounts)
-> Lens
     WorkflowExecutionOpenCounts
     WorkflowExecutionOpenCounts
     Natural
     Natural
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 :: (Natural -> f Natural)
-> WorkflowExecutionOpenCounts -> f WorkflowExecutionOpenCounts
workflowExecutionOpenCounts_openTimers = (WorkflowExecutionOpenCounts -> Natural)
-> (WorkflowExecutionOpenCounts
    -> Natural -> WorkflowExecutionOpenCounts)
-> Lens
     WorkflowExecutionOpenCounts
     WorkflowExecutionOpenCounts
     Natural
     Natural
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 :: (Natural -> f Natural)
-> WorkflowExecutionOpenCounts -> f WorkflowExecutionOpenCounts
workflowExecutionOpenCounts_openChildWorkflowExecutions = (WorkflowExecutionOpenCounts -> Natural)
-> (WorkflowExecutionOpenCounts
    -> Natural -> WorkflowExecutionOpenCounts)
-> Lens
     WorkflowExecutionOpenCounts
     WorkflowExecutionOpenCounts
     Natural
     Natural
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 Core.FromJSON WorkflowExecutionOpenCounts where
  parseJSON :: Value -> Parser WorkflowExecutionOpenCounts
parseJSON =
    String
-> (Object -> Parser WorkflowExecutionOpenCounts)
-> Value
-> Parser WorkflowExecutionOpenCounts
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkflowExecutionOpenCounts"
      ( \Object
x ->
          Maybe Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> WorkflowExecutionOpenCounts
WorkflowExecutionOpenCounts'
            (Maybe Natural
 -> Natural
 -> Natural
 -> Natural
 -> Natural
 -> WorkflowExecutionOpenCounts)
-> Parser (Maybe Natural)
-> Parser
     (Natural
      -> Natural -> Natural -> Natural -> WorkflowExecutionOpenCounts)
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
"openLambdaFunctions")
            Parser
  (Natural
   -> Natural -> Natural -> Natural -> WorkflowExecutionOpenCounts)
-> Parser Natural
-> Parser
     (Natural -> Natural -> Natural -> WorkflowExecutionOpenCounts)
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
"openActivityTasks")
            Parser
  (Natural -> Natural -> Natural -> WorkflowExecutionOpenCounts)
-> Parser Natural
-> Parser (Natural -> Natural -> WorkflowExecutionOpenCounts)
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
"openDecisionTasks")
            Parser (Natural -> Natural -> WorkflowExecutionOpenCounts)
-> Parser Natural
-> Parser (Natural -> WorkflowExecutionOpenCounts)
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
"openTimers")
            Parser (Natural -> WorkflowExecutionOpenCounts)
-> Parser Natural -> Parser WorkflowExecutionOpenCounts
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
"openChildWorkflowExecutions")
      )

instance Prelude.Hashable WorkflowExecutionOpenCounts

instance Prelude.NFData WorkflowExecutionOpenCounts