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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ChildWorkflowExecutionCompletedEventAttributes
 -> ChildWorkflowExecutionCompletedEventAttributes -> Bool)
-> (ChildWorkflowExecutionCompletedEventAttributes
    -> ChildWorkflowExecutionCompletedEventAttributes -> Bool)
-> Eq ChildWorkflowExecutionCompletedEventAttributes
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]
(Int -> ReadS ChildWorkflowExecutionCompletedEventAttributes)
-> ReadS [ChildWorkflowExecutionCompletedEventAttributes]
-> ReadPrec ChildWorkflowExecutionCompletedEventAttributes
-> ReadPrec [ChildWorkflowExecutionCompletedEventAttributes]
-> Read 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
(Int -> ChildWorkflowExecutionCompletedEventAttributes -> ShowS)
-> (ChildWorkflowExecutionCompletedEventAttributes -> String)
-> ([ChildWorkflowExecutionCompletedEventAttributes] -> ShowS)
-> Show ChildWorkflowExecutionCompletedEventAttributes
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.
 ChildWorkflowExecutionCompletedEventAttributes
 -> Rep ChildWorkflowExecutionCompletedEventAttributes x)
-> (forall x.
    Rep ChildWorkflowExecutionCompletedEventAttributes x
    -> ChildWorkflowExecutionCompletedEventAttributes)
-> Generic ChildWorkflowExecutionCompletedEventAttributes
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' :: Maybe Text
-> WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionCompletedEventAttributes
ChildWorkflowExecutionCompletedEventAttributes'
      { $sel:result:ChildWorkflowExecutionCompletedEventAttributes' :: Maybe Text
result =
          Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> ChildWorkflowExecutionCompletedEventAttributes
-> f ChildWorkflowExecutionCompletedEventAttributes
childWorkflowExecutionCompletedEventAttributes_result = (ChildWorkflowExecutionCompletedEventAttributes -> Maybe Text)
-> (ChildWorkflowExecutionCompletedEventAttributes
    -> Maybe Text -> ChildWorkflowExecutionCompletedEventAttributes)
-> Lens
     ChildWorkflowExecutionCompletedEventAttributes
     ChildWorkflowExecutionCompletedEventAttributes
     (Maybe Text)
     (Maybe Text)
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 :: (WorkflowExecution -> f WorkflowExecution)
-> ChildWorkflowExecutionCompletedEventAttributes
-> f ChildWorkflowExecutionCompletedEventAttributes
childWorkflowExecutionCompletedEventAttributes_workflowExecution = (ChildWorkflowExecutionCompletedEventAttributes
 -> WorkflowExecution)
-> (ChildWorkflowExecutionCompletedEventAttributes
    -> WorkflowExecution
    -> ChildWorkflowExecutionCompletedEventAttributes)
-> Lens
     ChildWorkflowExecutionCompletedEventAttributes
     ChildWorkflowExecutionCompletedEventAttributes
     WorkflowExecution
     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 :: (WorkflowType -> f WorkflowType)
-> ChildWorkflowExecutionCompletedEventAttributes
-> f ChildWorkflowExecutionCompletedEventAttributes
childWorkflowExecutionCompletedEventAttributes_workflowType = (ChildWorkflowExecutionCompletedEventAttributes -> WorkflowType)
-> (ChildWorkflowExecutionCompletedEventAttributes
    -> WorkflowType -> ChildWorkflowExecutionCompletedEventAttributes)
-> Lens
     ChildWorkflowExecutionCompletedEventAttributes
     ChildWorkflowExecutionCompletedEventAttributes
     WorkflowType
     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 :: (Integer -> f Integer)
-> ChildWorkflowExecutionCompletedEventAttributes
-> f ChildWorkflowExecutionCompletedEventAttributes
childWorkflowExecutionCompletedEventAttributes_initiatedEventId = (ChildWorkflowExecutionCompletedEventAttributes -> Integer)
-> (ChildWorkflowExecutionCompletedEventAttributes
    -> Integer -> ChildWorkflowExecutionCompletedEventAttributes)
-> Lens
     ChildWorkflowExecutionCompletedEventAttributes
     ChildWorkflowExecutionCompletedEventAttributes
     Integer
     Integer
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 :: (Integer -> f Integer)
-> ChildWorkflowExecutionCompletedEventAttributes
-> f ChildWorkflowExecutionCompletedEventAttributes
childWorkflowExecutionCompletedEventAttributes_startedEventId = (ChildWorkflowExecutionCompletedEventAttributes -> Integer)
-> (ChildWorkflowExecutionCompletedEventAttributes
    -> Integer -> ChildWorkflowExecutionCompletedEventAttributes)
-> Lens
     ChildWorkflowExecutionCompletedEventAttributes
     ChildWorkflowExecutionCompletedEventAttributes
     Integer
     Integer
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
  Core.FromJSON
    ChildWorkflowExecutionCompletedEventAttributes
  where
  parseJSON :: Value -> Parser ChildWorkflowExecutionCompletedEventAttributes
parseJSON =
    String
-> (Object
    -> Parser ChildWorkflowExecutionCompletedEventAttributes)
-> Value
-> Parser ChildWorkflowExecutionCompletedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ChildWorkflowExecutionCompletedEventAttributes"
      ( \Object
x ->
          Maybe Text
-> WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionCompletedEventAttributes
ChildWorkflowExecutionCompletedEventAttributes'
            (Maybe Text
 -> WorkflowExecution
 -> WorkflowType
 -> Integer
 -> Integer
 -> ChildWorkflowExecutionCompletedEventAttributes)
-> Parser (Maybe Text)
-> Parser
     (WorkflowExecution
      -> WorkflowType
      -> Integer
      -> Integer
      -> ChildWorkflowExecutionCompletedEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"result")
              Parser
  (WorkflowExecution
   -> WorkflowType
   -> Integer
   -> Integer
   -> ChildWorkflowExecutionCompletedEventAttributes)
-> Parser WorkflowExecution
-> Parser
     (WorkflowType
      -> Integer
      -> Integer
      -> ChildWorkflowExecutionCompletedEventAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser WorkflowExecution
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"workflowExecution")
              Parser
  (WorkflowType
   -> Integer
   -> Integer
   -> ChildWorkflowExecutionCompletedEventAttributes)
-> Parser WorkflowType
-> Parser
     (Integer
      -> Integer -> ChildWorkflowExecutionCompletedEventAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser WorkflowType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"workflowType")
              Parser
  (Integer
   -> Integer -> ChildWorkflowExecutionCompletedEventAttributes)
-> Parser Integer
-> Parser
     (Integer -> ChildWorkflowExecutionCompletedEventAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"initiatedEventId")
              Parser (Integer -> ChildWorkflowExecutionCompletedEventAttributes)
-> Parser Integer
-> Parser ChildWorkflowExecutionCompletedEventAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"startedEventId")
      )

instance
  Prelude.Hashable
    ChildWorkflowExecutionCompletedEventAttributes

instance
  Prelude.NFData
    ChildWorkflowExecutionCompletedEventAttributes