{-# 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.ChildWorkflowExecutionTerminatedEventAttributes
-- 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.ChildWorkflowExecutionTerminatedEventAttributes 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 @ChildWorkflowExecutionTerminated@ event.
--
-- /See:/ 'newChildWorkflowExecutionTerminatedEventAttributes' smart constructor.
data ChildWorkflowExecutionTerminatedEventAttributes = ChildWorkflowExecutionTerminatedEventAttributes'
  { -- | The child workflow execution that was terminated.
    ChildWorkflowExecutionTerminatedEventAttributes
-> WorkflowExecution
workflowExecution :: WorkflowExecution,
    -- | The type of the child workflow execution.
    ChildWorkflowExecutionTerminatedEventAttributes -> 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.
    ChildWorkflowExecutionTerminatedEventAttributes -> 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.
    ChildWorkflowExecutionTerminatedEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (ChildWorkflowExecutionTerminatedEventAttributes
-> ChildWorkflowExecutionTerminatedEventAttributes -> Bool
(ChildWorkflowExecutionTerminatedEventAttributes
 -> ChildWorkflowExecutionTerminatedEventAttributes -> Bool)
-> (ChildWorkflowExecutionTerminatedEventAttributes
    -> ChildWorkflowExecutionTerminatedEventAttributes -> Bool)
-> Eq ChildWorkflowExecutionTerminatedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChildWorkflowExecutionTerminatedEventAttributes
-> ChildWorkflowExecutionTerminatedEventAttributes -> Bool
$c/= :: ChildWorkflowExecutionTerminatedEventAttributes
-> ChildWorkflowExecutionTerminatedEventAttributes -> Bool
== :: ChildWorkflowExecutionTerminatedEventAttributes
-> ChildWorkflowExecutionTerminatedEventAttributes -> Bool
$c== :: ChildWorkflowExecutionTerminatedEventAttributes
-> ChildWorkflowExecutionTerminatedEventAttributes -> Bool
Prelude.Eq, ReadPrec [ChildWorkflowExecutionTerminatedEventAttributes]
ReadPrec ChildWorkflowExecutionTerminatedEventAttributes
Int -> ReadS ChildWorkflowExecutionTerminatedEventAttributes
ReadS [ChildWorkflowExecutionTerminatedEventAttributes]
(Int -> ReadS ChildWorkflowExecutionTerminatedEventAttributes)
-> ReadS [ChildWorkflowExecutionTerminatedEventAttributes]
-> ReadPrec ChildWorkflowExecutionTerminatedEventAttributes
-> ReadPrec [ChildWorkflowExecutionTerminatedEventAttributes]
-> Read ChildWorkflowExecutionTerminatedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChildWorkflowExecutionTerminatedEventAttributes]
$creadListPrec :: ReadPrec [ChildWorkflowExecutionTerminatedEventAttributes]
readPrec :: ReadPrec ChildWorkflowExecutionTerminatedEventAttributes
$creadPrec :: ReadPrec ChildWorkflowExecutionTerminatedEventAttributes
readList :: ReadS [ChildWorkflowExecutionTerminatedEventAttributes]
$creadList :: ReadS [ChildWorkflowExecutionTerminatedEventAttributes]
readsPrec :: Int -> ReadS ChildWorkflowExecutionTerminatedEventAttributes
$creadsPrec :: Int -> ReadS ChildWorkflowExecutionTerminatedEventAttributes
Prelude.Read, Int -> ChildWorkflowExecutionTerminatedEventAttributes -> ShowS
[ChildWorkflowExecutionTerminatedEventAttributes] -> ShowS
ChildWorkflowExecutionTerminatedEventAttributes -> String
(Int -> ChildWorkflowExecutionTerminatedEventAttributes -> ShowS)
-> (ChildWorkflowExecutionTerminatedEventAttributes -> String)
-> ([ChildWorkflowExecutionTerminatedEventAttributes] -> ShowS)
-> Show ChildWorkflowExecutionTerminatedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChildWorkflowExecutionTerminatedEventAttributes] -> ShowS
$cshowList :: [ChildWorkflowExecutionTerminatedEventAttributes] -> ShowS
show :: ChildWorkflowExecutionTerminatedEventAttributes -> String
$cshow :: ChildWorkflowExecutionTerminatedEventAttributes -> String
showsPrec :: Int -> ChildWorkflowExecutionTerminatedEventAttributes -> ShowS
$cshowsPrec :: Int -> ChildWorkflowExecutionTerminatedEventAttributes -> ShowS
Prelude.Show, (forall x.
 ChildWorkflowExecutionTerminatedEventAttributes
 -> Rep ChildWorkflowExecutionTerminatedEventAttributes x)
-> (forall x.
    Rep ChildWorkflowExecutionTerminatedEventAttributes x
    -> ChildWorkflowExecutionTerminatedEventAttributes)
-> Generic ChildWorkflowExecutionTerminatedEventAttributes
forall x.
Rep ChildWorkflowExecutionTerminatedEventAttributes x
-> ChildWorkflowExecutionTerminatedEventAttributes
forall x.
ChildWorkflowExecutionTerminatedEventAttributes
-> Rep ChildWorkflowExecutionTerminatedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ChildWorkflowExecutionTerminatedEventAttributes x
-> ChildWorkflowExecutionTerminatedEventAttributes
$cfrom :: forall x.
ChildWorkflowExecutionTerminatedEventAttributes
-> Rep ChildWorkflowExecutionTerminatedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ChildWorkflowExecutionTerminatedEventAttributes' 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:
--
-- 'workflowExecution', 'childWorkflowExecutionTerminatedEventAttributes_workflowExecution' - The child workflow execution that was terminated.
--
-- 'workflowType', 'childWorkflowExecutionTerminatedEventAttributes_workflowType' - The type of the child workflow execution.
--
-- 'initiatedEventId', 'childWorkflowExecutionTerminatedEventAttributes_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', 'childWorkflowExecutionTerminatedEventAttributes_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.
newChildWorkflowExecutionTerminatedEventAttributes ::
  -- | 'workflowExecution'
  WorkflowExecution ->
  -- | 'workflowType'
  WorkflowType ->
  -- | 'initiatedEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  ChildWorkflowExecutionTerminatedEventAttributes
newChildWorkflowExecutionTerminatedEventAttributes :: WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionTerminatedEventAttributes
newChildWorkflowExecutionTerminatedEventAttributes
  WorkflowExecution
pWorkflowExecution_
  WorkflowType
pWorkflowType_
  Integer
pInitiatedEventId_
  Integer
pStartedEventId_ =
    ChildWorkflowExecutionTerminatedEventAttributes' :: WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionTerminatedEventAttributes
ChildWorkflowExecutionTerminatedEventAttributes'
      { $sel:workflowExecution:ChildWorkflowExecutionTerminatedEventAttributes' :: WorkflowExecution
workflowExecution =
          WorkflowExecution
pWorkflowExecution_,
        $sel:workflowType:ChildWorkflowExecutionTerminatedEventAttributes' :: WorkflowType
workflowType =
          WorkflowType
pWorkflowType_,
        $sel:initiatedEventId:ChildWorkflowExecutionTerminatedEventAttributes' :: Integer
initiatedEventId =
          Integer
pInitiatedEventId_,
        $sel:startedEventId:ChildWorkflowExecutionTerminatedEventAttributes' :: Integer
startedEventId =
          Integer
pStartedEventId_
      }

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

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

-- | 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.
childWorkflowExecutionTerminatedEventAttributes_initiatedEventId :: Lens.Lens' ChildWorkflowExecutionTerminatedEventAttributes Prelude.Integer
childWorkflowExecutionTerminatedEventAttributes_initiatedEventId :: (Integer -> f Integer)
-> ChildWorkflowExecutionTerminatedEventAttributes
-> f ChildWorkflowExecutionTerminatedEventAttributes
childWorkflowExecutionTerminatedEventAttributes_initiatedEventId = (ChildWorkflowExecutionTerminatedEventAttributes -> Integer)
-> (ChildWorkflowExecutionTerminatedEventAttributes
    -> Integer -> ChildWorkflowExecutionTerminatedEventAttributes)
-> Lens
     ChildWorkflowExecutionTerminatedEventAttributes
     ChildWorkflowExecutionTerminatedEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionTerminatedEventAttributes' {Integer
initiatedEventId :: Integer
$sel:initiatedEventId:ChildWorkflowExecutionTerminatedEventAttributes' :: ChildWorkflowExecutionTerminatedEventAttributes -> Integer
initiatedEventId} -> Integer
initiatedEventId) (\s :: ChildWorkflowExecutionTerminatedEventAttributes
s@ChildWorkflowExecutionTerminatedEventAttributes' {} Integer
a -> ChildWorkflowExecutionTerminatedEventAttributes
s {$sel:initiatedEventId:ChildWorkflowExecutionTerminatedEventAttributes' :: Integer
initiatedEventId = Integer
a} :: ChildWorkflowExecutionTerminatedEventAttributes)

-- | 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.
childWorkflowExecutionTerminatedEventAttributes_startedEventId :: Lens.Lens' ChildWorkflowExecutionTerminatedEventAttributes Prelude.Integer
childWorkflowExecutionTerminatedEventAttributes_startedEventId :: (Integer -> f Integer)
-> ChildWorkflowExecutionTerminatedEventAttributes
-> f ChildWorkflowExecutionTerminatedEventAttributes
childWorkflowExecutionTerminatedEventAttributes_startedEventId = (ChildWorkflowExecutionTerminatedEventAttributes -> Integer)
-> (ChildWorkflowExecutionTerminatedEventAttributes
    -> Integer -> ChildWorkflowExecutionTerminatedEventAttributes)
-> Lens
     ChildWorkflowExecutionTerminatedEventAttributes
     ChildWorkflowExecutionTerminatedEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionTerminatedEventAttributes' {Integer
startedEventId :: Integer
$sel:startedEventId:ChildWorkflowExecutionTerminatedEventAttributes' :: ChildWorkflowExecutionTerminatedEventAttributes -> Integer
startedEventId} -> Integer
startedEventId) (\s :: ChildWorkflowExecutionTerminatedEventAttributes
s@ChildWorkflowExecutionTerminatedEventAttributes' {} Integer
a -> ChildWorkflowExecutionTerminatedEventAttributes
s {$sel:startedEventId:ChildWorkflowExecutionTerminatedEventAttributes' :: Integer
startedEventId = Integer
a} :: ChildWorkflowExecutionTerminatedEventAttributes)

instance
  Core.FromJSON
    ChildWorkflowExecutionTerminatedEventAttributes
  where
  parseJSON :: Value -> Parser ChildWorkflowExecutionTerminatedEventAttributes
parseJSON =
    String
-> (Object
    -> Parser ChildWorkflowExecutionTerminatedEventAttributes)
-> Value
-> Parser ChildWorkflowExecutionTerminatedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ChildWorkflowExecutionTerminatedEventAttributes"
      ( \Object
x ->
          WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionTerminatedEventAttributes
ChildWorkflowExecutionTerminatedEventAttributes'
            (WorkflowExecution
 -> WorkflowType
 -> Integer
 -> Integer
 -> ChildWorkflowExecutionTerminatedEventAttributes)
-> Parser WorkflowExecution
-> Parser
     (WorkflowType
      -> Integer
      -> Integer
      -> ChildWorkflowExecutionTerminatedEventAttributes)
forall (f :: * -> *) a b. Functor 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
   -> ChildWorkflowExecutionTerminatedEventAttributes)
-> Parser WorkflowType
-> Parser
     (Integer
      -> Integer -> ChildWorkflowExecutionTerminatedEventAttributes)
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 -> ChildWorkflowExecutionTerminatedEventAttributes)
-> Parser Integer
-> Parser
     (Integer -> ChildWorkflowExecutionTerminatedEventAttributes)
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 -> ChildWorkflowExecutionTerminatedEventAttributes)
-> Parser Integer
-> Parser ChildWorkflowExecutionTerminatedEventAttributes
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
    ChildWorkflowExecutionTerminatedEventAttributes

instance
  Prelude.NFData
    ChildWorkflowExecutionTerminatedEventAttributes