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

-- |
-- Create a value of 'ChildWorkflowExecutionStartedEventAttributes' 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', 'childWorkflowExecutionStartedEventAttributes_workflowExecution' - The child workflow execution that was started.
--
-- 'workflowType', 'childWorkflowExecutionStartedEventAttributes_workflowType' - The type of the child workflow execution.
--
-- 'initiatedEventId', 'childWorkflowExecutionStartedEventAttributes_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.
newChildWorkflowExecutionStartedEventAttributes ::
  -- | 'workflowExecution'
  WorkflowExecution ->
  -- | 'workflowType'
  WorkflowType ->
  -- | 'initiatedEventId'
  Prelude.Integer ->
  ChildWorkflowExecutionStartedEventAttributes
newChildWorkflowExecutionStartedEventAttributes :: WorkflowExecution
-> WorkflowType
-> Integer
-> ChildWorkflowExecutionStartedEventAttributes
newChildWorkflowExecutionStartedEventAttributes
  WorkflowExecution
pWorkflowExecution_
  WorkflowType
pWorkflowType_
  Integer
pInitiatedEventId_ =
    ChildWorkflowExecutionStartedEventAttributes' :: WorkflowExecution
-> WorkflowType
-> Integer
-> ChildWorkflowExecutionStartedEventAttributes
ChildWorkflowExecutionStartedEventAttributes'
      { $sel:workflowExecution:ChildWorkflowExecutionStartedEventAttributes' :: WorkflowExecution
workflowExecution =
          WorkflowExecution
pWorkflowExecution_,
        $sel:workflowType:ChildWorkflowExecutionStartedEventAttributes' :: WorkflowType
workflowType = WorkflowType
pWorkflowType_,
        $sel:initiatedEventId:ChildWorkflowExecutionStartedEventAttributes' :: Integer
initiatedEventId =
          Integer
pInitiatedEventId_
      }

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

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

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

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

instance
  Prelude.Hashable
    ChildWorkflowExecutionStartedEventAttributes

instance
  Prelude.NFData
    ChildWorkflowExecutionStartedEventAttributes