{-# 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-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.ChildWorkflowExecutionStartedEventAttributes 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 @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
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]
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
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.
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'
      { $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 :: Lens'
  ChildWorkflowExecutionStartedEventAttributes WorkflowExecution
childWorkflowExecutionStartedEventAttributes_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 :: Lens' ChildWorkflowExecutionStartedEventAttributes WorkflowType
childWorkflowExecutionStartedEventAttributes_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 :: Lens' ChildWorkflowExecutionStartedEventAttributes Integer
childWorkflowExecutionStartedEventAttributes_initiatedEventId = 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
  Data.FromJSON
    ChildWorkflowExecutionStartedEventAttributes
  where
  parseJSON :: Value -> Parser ChildWorkflowExecutionStartedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ChildWorkflowExecutionStartedEventAttributes"
      ( \Object
x ->
          WorkflowExecution
-> WorkflowType
-> Integer
-> ChildWorkflowExecutionStartedEventAttributes
ChildWorkflowExecutionStartedEventAttributes'
            forall (f :: * -> *) a b. Functor 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")
      )

instance
  Prelude.Hashable
    ChildWorkflowExecutionStartedEventAttributes
  where
  hashWithSalt :: Int -> ChildWorkflowExecutionStartedEventAttributes -> Int
hashWithSalt
    Int
_salt
    ChildWorkflowExecutionStartedEventAttributes' {Integer
WorkflowExecution
WorkflowType
initiatedEventId :: Integer
workflowType :: WorkflowType
workflowExecution :: WorkflowExecution
$sel:initiatedEventId:ChildWorkflowExecutionStartedEventAttributes' :: ChildWorkflowExecutionStartedEventAttributes -> Integer
$sel:workflowType:ChildWorkflowExecutionStartedEventAttributes' :: ChildWorkflowExecutionStartedEventAttributes -> WorkflowType
$sel:workflowExecution:ChildWorkflowExecutionStartedEventAttributes' :: ChildWorkflowExecutionStartedEventAttributes -> WorkflowExecution
..} =
      Int
_salt
        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

instance
  Prelude.NFData
    ChildWorkflowExecutionStartedEventAttributes
  where
  rnf :: ChildWorkflowExecutionStartedEventAttributes -> ()
rnf ChildWorkflowExecutionStartedEventAttributes' {Integer
WorkflowExecution
WorkflowType
initiatedEventId :: Integer
workflowType :: WorkflowType
workflowExecution :: WorkflowExecution
$sel:initiatedEventId:ChildWorkflowExecutionStartedEventAttributes' :: ChildWorkflowExecutionStartedEventAttributes -> Integer
$sel:workflowType:ChildWorkflowExecutionStartedEventAttributes' :: ChildWorkflowExecutionStartedEventAttributes -> WorkflowType
$sel:workflowExecution:ChildWorkflowExecutionStartedEventAttributes' :: ChildWorkflowExecutionStartedEventAttributes -> WorkflowExecution
..} =
    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