{-# 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.ChildWorkflowExecutionCompletedEventAttributes
-- 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.ChildWorkflowExecutionCompletedEventAttributes 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
import Amazonka.SWF.Types.WorkflowExecution
import Amazonka.SWF.Types.WorkflowType

-- | Provides the details of the @ChildWorkflowExecutionCompleted@ event.
--
-- /See:/ 'newChildWorkflowExecutionCompletedEventAttributes' smart constructor.
data ChildWorkflowExecutionCompletedEventAttributes = ChildWorkflowExecutionCompletedEventAttributes'
  { -- | The result of the child workflow execution.
    ChildWorkflowExecutionCompletedEventAttributes -> Maybe Text
result :: Prelude.Maybe Prelude.Text,
    -- | The child workflow execution that was completed.
    ChildWorkflowExecutionCompletedEventAttributes -> WorkflowExecution
workflowExecution :: WorkflowExecution,
    -- | The type of the child workflow execution.
    ChildWorkflowExecutionCompletedEventAttributes -> WorkflowType
workflowType :: WorkflowType,
    -- | The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding
    -- to the @StartChildWorkflowExecution@ Decision to start this child
    -- workflow execution. This information can be useful for diagnosing
    -- problems by tracing back the chain of events leading up to this event.
    ChildWorkflowExecutionCompletedEventAttributes -> Integer
initiatedEventId :: Prelude.Integer,
    -- | The ID of the @ChildWorkflowExecutionStarted@ event recorded when this
    -- child workflow execution was started. This information can be useful for
    -- diagnosing problems by tracing back the chain of events leading up to
    -- this event.
    ChildWorkflowExecutionCompletedEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (ChildWorkflowExecutionCompletedEventAttributes
-> ChildWorkflowExecutionCompletedEventAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChildWorkflowExecutionCompletedEventAttributes
-> ChildWorkflowExecutionCompletedEventAttributes -> Bool
$c/= :: ChildWorkflowExecutionCompletedEventAttributes
-> ChildWorkflowExecutionCompletedEventAttributes -> Bool
== :: ChildWorkflowExecutionCompletedEventAttributes
-> ChildWorkflowExecutionCompletedEventAttributes -> Bool
$c== :: ChildWorkflowExecutionCompletedEventAttributes
-> ChildWorkflowExecutionCompletedEventAttributes -> Bool
Prelude.Eq, ReadPrec [ChildWorkflowExecutionCompletedEventAttributes]
ReadPrec ChildWorkflowExecutionCompletedEventAttributes
Int -> ReadS ChildWorkflowExecutionCompletedEventAttributes
ReadS [ChildWorkflowExecutionCompletedEventAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChildWorkflowExecutionCompletedEventAttributes]
$creadListPrec :: ReadPrec [ChildWorkflowExecutionCompletedEventAttributes]
readPrec :: ReadPrec ChildWorkflowExecutionCompletedEventAttributes
$creadPrec :: ReadPrec ChildWorkflowExecutionCompletedEventAttributes
readList :: ReadS [ChildWorkflowExecutionCompletedEventAttributes]
$creadList :: ReadS [ChildWorkflowExecutionCompletedEventAttributes]
readsPrec :: Int -> ReadS ChildWorkflowExecutionCompletedEventAttributes
$creadsPrec :: Int -> ReadS ChildWorkflowExecutionCompletedEventAttributes
Prelude.Read, Int -> ChildWorkflowExecutionCompletedEventAttributes -> ShowS
[ChildWorkflowExecutionCompletedEventAttributes] -> ShowS
ChildWorkflowExecutionCompletedEventAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChildWorkflowExecutionCompletedEventAttributes] -> ShowS
$cshowList :: [ChildWorkflowExecutionCompletedEventAttributes] -> ShowS
show :: ChildWorkflowExecutionCompletedEventAttributes -> String
$cshow :: ChildWorkflowExecutionCompletedEventAttributes -> String
showsPrec :: Int -> ChildWorkflowExecutionCompletedEventAttributes -> ShowS
$cshowsPrec :: Int -> ChildWorkflowExecutionCompletedEventAttributes -> ShowS
Prelude.Show, forall x.
Rep ChildWorkflowExecutionCompletedEventAttributes x
-> ChildWorkflowExecutionCompletedEventAttributes
forall x.
ChildWorkflowExecutionCompletedEventAttributes
-> Rep ChildWorkflowExecutionCompletedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ChildWorkflowExecutionCompletedEventAttributes x
-> ChildWorkflowExecutionCompletedEventAttributes
$cfrom :: forall x.
ChildWorkflowExecutionCompletedEventAttributes
-> Rep ChildWorkflowExecutionCompletedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ChildWorkflowExecutionCompletedEventAttributes' 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:
--
-- 'result', 'childWorkflowExecutionCompletedEventAttributes_result' - The result of the child workflow execution.
--
-- 'workflowExecution', 'childWorkflowExecutionCompletedEventAttributes_workflowExecution' - The child workflow execution that was completed.
--
-- 'workflowType', 'childWorkflowExecutionCompletedEventAttributes_workflowType' - The type of the child workflow execution.
--
-- 'initiatedEventId', 'childWorkflowExecutionCompletedEventAttributes_initiatedEventId' - The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding
-- to the @StartChildWorkflowExecution@ Decision to start this child
-- workflow execution. This information can be useful for diagnosing
-- problems by tracing back the chain of events leading up to this event.
--
-- 'startedEventId', 'childWorkflowExecutionCompletedEventAttributes_startedEventId' - The ID of the @ChildWorkflowExecutionStarted@ event recorded when this
-- child workflow execution was started. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
newChildWorkflowExecutionCompletedEventAttributes ::
  -- | 'workflowExecution'
  WorkflowExecution ->
  -- | 'workflowType'
  WorkflowType ->
  -- | 'initiatedEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  ChildWorkflowExecutionCompletedEventAttributes
newChildWorkflowExecutionCompletedEventAttributes :: WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionCompletedEventAttributes
newChildWorkflowExecutionCompletedEventAttributes
  WorkflowExecution
pWorkflowExecution_
  WorkflowType
pWorkflowType_
  Integer
pInitiatedEventId_
  Integer
pStartedEventId_ =
    ChildWorkflowExecutionCompletedEventAttributes'
      { $sel:result:ChildWorkflowExecutionCompletedEventAttributes' :: Maybe Text
result =
          forall a. Maybe a
Prelude.Nothing,
        $sel:workflowExecution:ChildWorkflowExecutionCompletedEventAttributes' :: WorkflowExecution
workflowExecution =
          WorkflowExecution
pWorkflowExecution_,
        $sel:workflowType:ChildWorkflowExecutionCompletedEventAttributes' :: WorkflowType
workflowType =
          WorkflowType
pWorkflowType_,
        $sel:initiatedEventId:ChildWorkflowExecutionCompletedEventAttributes' :: Integer
initiatedEventId =
          Integer
pInitiatedEventId_,
        $sel:startedEventId:ChildWorkflowExecutionCompletedEventAttributes' :: Integer
startedEventId =
          Integer
pStartedEventId_
      }

-- | The result of the child workflow execution.
childWorkflowExecutionCompletedEventAttributes_result :: Lens.Lens' ChildWorkflowExecutionCompletedEventAttributes (Prelude.Maybe Prelude.Text)
childWorkflowExecutionCompletedEventAttributes_result :: Lens' ChildWorkflowExecutionCompletedEventAttributes (Maybe Text)
childWorkflowExecutionCompletedEventAttributes_result = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCompletedEventAttributes' {Maybe Text
result :: Maybe Text
$sel:result:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> Maybe Text
result} -> Maybe Text
result) (\s :: ChildWorkflowExecutionCompletedEventAttributes
s@ChildWorkflowExecutionCompletedEventAttributes' {} Maybe Text
a -> ChildWorkflowExecutionCompletedEventAttributes
s {$sel:result:ChildWorkflowExecutionCompletedEventAttributes' :: Maybe Text
result = Maybe Text
a} :: ChildWorkflowExecutionCompletedEventAttributes)

-- | The child workflow execution that was completed.
childWorkflowExecutionCompletedEventAttributes_workflowExecution :: Lens.Lens' ChildWorkflowExecutionCompletedEventAttributes WorkflowExecution
childWorkflowExecutionCompletedEventAttributes_workflowExecution :: Lens'
  ChildWorkflowExecutionCompletedEventAttributes WorkflowExecution
childWorkflowExecutionCompletedEventAttributes_workflowExecution = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCompletedEventAttributes' {WorkflowExecution
workflowExecution :: WorkflowExecution
$sel:workflowExecution:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> WorkflowExecution
workflowExecution} -> WorkflowExecution
workflowExecution) (\s :: ChildWorkflowExecutionCompletedEventAttributes
s@ChildWorkflowExecutionCompletedEventAttributes' {} WorkflowExecution
a -> ChildWorkflowExecutionCompletedEventAttributes
s {$sel:workflowExecution:ChildWorkflowExecutionCompletedEventAttributes' :: WorkflowExecution
workflowExecution = WorkflowExecution
a} :: ChildWorkflowExecutionCompletedEventAttributes)

-- | The type of the child workflow execution.
childWorkflowExecutionCompletedEventAttributes_workflowType :: Lens.Lens' ChildWorkflowExecutionCompletedEventAttributes WorkflowType
childWorkflowExecutionCompletedEventAttributes_workflowType :: Lens' ChildWorkflowExecutionCompletedEventAttributes WorkflowType
childWorkflowExecutionCompletedEventAttributes_workflowType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCompletedEventAttributes' {WorkflowType
workflowType :: WorkflowType
$sel:workflowType:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> WorkflowType
workflowType} -> WorkflowType
workflowType) (\s :: ChildWorkflowExecutionCompletedEventAttributes
s@ChildWorkflowExecutionCompletedEventAttributes' {} WorkflowType
a -> ChildWorkflowExecutionCompletedEventAttributes
s {$sel:workflowType:ChildWorkflowExecutionCompletedEventAttributes' :: WorkflowType
workflowType = WorkflowType
a} :: ChildWorkflowExecutionCompletedEventAttributes)

-- | The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding
-- to the @StartChildWorkflowExecution@ Decision to start this child
-- workflow execution. This information can be useful for diagnosing
-- problems by tracing back the chain of events leading up to this event.
childWorkflowExecutionCompletedEventAttributes_initiatedEventId :: Lens.Lens' ChildWorkflowExecutionCompletedEventAttributes Prelude.Integer
childWorkflowExecutionCompletedEventAttributes_initiatedEventId :: Lens' ChildWorkflowExecutionCompletedEventAttributes Integer
childWorkflowExecutionCompletedEventAttributes_initiatedEventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCompletedEventAttributes' {Integer
initiatedEventId :: Integer
$sel:initiatedEventId:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> Integer
initiatedEventId} -> Integer
initiatedEventId) (\s :: ChildWorkflowExecutionCompletedEventAttributes
s@ChildWorkflowExecutionCompletedEventAttributes' {} Integer
a -> ChildWorkflowExecutionCompletedEventAttributes
s {$sel:initiatedEventId:ChildWorkflowExecutionCompletedEventAttributes' :: Integer
initiatedEventId = Integer
a} :: ChildWorkflowExecutionCompletedEventAttributes)

-- | The ID of the @ChildWorkflowExecutionStarted@ event recorded when this
-- child workflow execution was started. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
childWorkflowExecutionCompletedEventAttributes_startedEventId :: Lens.Lens' ChildWorkflowExecutionCompletedEventAttributes Prelude.Integer
childWorkflowExecutionCompletedEventAttributes_startedEventId :: Lens' ChildWorkflowExecutionCompletedEventAttributes Integer
childWorkflowExecutionCompletedEventAttributes_startedEventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCompletedEventAttributes' {Integer
startedEventId :: Integer
$sel:startedEventId:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> Integer
startedEventId} -> Integer
startedEventId) (\s :: ChildWorkflowExecutionCompletedEventAttributes
s@ChildWorkflowExecutionCompletedEventAttributes' {} Integer
a -> ChildWorkflowExecutionCompletedEventAttributes
s {$sel:startedEventId:ChildWorkflowExecutionCompletedEventAttributes' :: Integer
startedEventId = Integer
a} :: ChildWorkflowExecutionCompletedEventAttributes)

instance
  Data.FromJSON
    ChildWorkflowExecutionCompletedEventAttributes
  where
  parseJSON :: Value -> Parser ChildWorkflowExecutionCompletedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ChildWorkflowExecutionCompletedEventAttributes"
      ( \Object
x ->
          Maybe Text
-> WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionCompletedEventAttributes
ChildWorkflowExecutionCompletedEventAttributes'
            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
"result")
            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
"workflowExecution")
            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
"workflowType")
            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
"initiatedEventId")
            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
"startedEventId")
      )

instance
  Prelude.Hashable
    ChildWorkflowExecutionCompletedEventAttributes
  where
  hashWithSalt :: Int -> ChildWorkflowExecutionCompletedEventAttributes -> Int
hashWithSalt
    Int
_salt
    ChildWorkflowExecutionCompletedEventAttributes' {Integer
Maybe Text
WorkflowExecution
WorkflowType
startedEventId :: Integer
initiatedEventId :: Integer
workflowType :: WorkflowType
workflowExecution :: WorkflowExecution
result :: Maybe Text
$sel:startedEventId:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> Integer
$sel:initiatedEventId:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> Integer
$sel:workflowType:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> WorkflowType
$sel:workflowExecution:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> WorkflowExecution
$sel:result:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
result
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WorkflowExecution
workflowExecution
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WorkflowType
workflowType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
initiatedEventId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
startedEventId

instance
  Prelude.NFData
    ChildWorkflowExecutionCompletedEventAttributes
  where
  rnf :: ChildWorkflowExecutionCompletedEventAttributes -> ()
rnf
    ChildWorkflowExecutionCompletedEventAttributes' {Integer
Maybe Text
WorkflowExecution
WorkflowType
startedEventId :: Integer
initiatedEventId :: Integer
workflowType :: WorkflowType
workflowExecution :: WorkflowExecution
result :: Maybe Text
$sel:startedEventId:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> Integer
$sel:initiatedEventId:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> Integer
$sel:workflowType:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> WorkflowType
$sel:workflowExecution:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> WorkflowExecution
$sel:result:ChildWorkflowExecutionCompletedEventAttributes' :: ChildWorkflowExecutionCompletedEventAttributes -> Maybe Text
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
result
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WorkflowExecution
workflowExecution
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WorkflowType
workflowType
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
initiatedEventId
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
startedEventId