{-# 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.ChildWorkflowExecutionCanceledEventAttributes
-- 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.ChildWorkflowExecutionCanceledEventAttributes 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

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

-- |
-- Create a value of 'ChildWorkflowExecutionCanceledEventAttributes' 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:
--
-- 'details', 'childWorkflowExecutionCanceledEventAttributes_details' - Details of the cancellation (if provided).
--
-- 'workflowExecution', 'childWorkflowExecutionCanceledEventAttributes_workflowExecution' - The child workflow execution that was canceled.
--
-- 'workflowType', 'childWorkflowExecutionCanceledEventAttributes_workflowType' - The type of the child workflow execution.
--
-- 'initiatedEventId', 'childWorkflowExecutionCanceledEventAttributes_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', 'childWorkflowExecutionCanceledEventAttributes_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.
newChildWorkflowExecutionCanceledEventAttributes ::
  -- | 'workflowExecution'
  WorkflowExecution ->
  -- | 'workflowType'
  WorkflowType ->
  -- | 'initiatedEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  ChildWorkflowExecutionCanceledEventAttributes
newChildWorkflowExecutionCanceledEventAttributes :: WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionCanceledEventAttributes
newChildWorkflowExecutionCanceledEventAttributes
  WorkflowExecution
pWorkflowExecution_
  WorkflowType
pWorkflowType_
  Integer
pInitiatedEventId_
  Integer
pStartedEventId_ =
    ChildWorkflowExecutionCanceledEventAttributes'
      { $sel:details:ChildWorkflowExecutionCanceledEventAttributes' :: Maybe Text
details =
          forall a. Maybe a
Prelude.Nothing,
        $sel:workflowExecution:ChildWorkflowExecutionCanceledEventAttributes' :: WorkflowExecution
workflowExecution =
          WorkflowExecution
pWorkflowExecution_,
        $sel:workflowType:ChildWorkflowExecutionCanceledEventAttributes' :: WorkflowType
workflowType =
          WorkflowType
pWorkflowType_,
        $sel:initiatedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: Integer
initiatedEventId =
          Integer
pInitiatedEventId_,
        $sel:startedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: Integer
startedEventId =
          Integer
pStartedEventId_
      }

-- | Details of the cancellation (if provided).
childWorkflowExecutionCanceledEventAttributes_details :: Lens.Lens' ChildWorkflowExecutionCanceledEventAttributes (Prelude.Maybe Prelude.Text)
childWorkflowExecutionCanceledEventAttributes_details :: Lens' ChildWorkflowExecutionCanceledEventAttributes (Maybe Text)
childWorkflowExecutionCanceledEventAttributes_details = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCanceledEventAttributes' {Maybe Text
details :: Maybe Text
$sel:details:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> Maybe Text
details} -> Maybe Text
details) (\s :: ChildWorkflowExecutionCanceledEventAttributes
s@ChildWorkflowExecutionCanceledEventAttributes' {} Maybe Text
a -> ChildWorkflowExecutionCanceledEventAttributes
s {$sel:details:ChildWorkflowExecutionCanceledEventAttributes' :: Maybe Text
details = Maybe Text
a} :: ChildWorkflowExecutionCanceledEventAttributes)

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

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

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

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

instance
  Data.FromJSON
    ChildWorkflowExecutionCanceledEventAttributes
  where
  parseJSON :: Value -> Parser ChildWorkflowExecutionCanceledEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ChildWorkflowExecutionCanceledEventAttributes"
      ( \Object
x ->
          Maybe Text
-> WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionCanceledEventAttributes
ChildWorkflowExecutionCanceledEventAttributes'
            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
"details")
            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
    ChildWorkflowExecutionCanceledEventAttributes
  where
  hashWithSalt :: Int -> ChildWorkflowExecutionCanceledEventAttributes -> Int
hashWithSalt
    Int
_salt
    ChildWorkflowExecutionCanceledEventAttributes' {Integer
Maybe Text
WorkflowExecution
WorkflowType
startedEventId :: Integer
initiatedEventId :: Integer
workflowType :: WorkflowType
workflowExecution :: WorkflowExecution
details :: Maybe Text
$sel:startedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> Integer
$sel:initiatedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> Integer
$sel:workflowType:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> WorkflowType
$sel:workflowExecution:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> WorkflowExecution
$sel:details:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
details
        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
    ChildWorkflowExecutionCanceledEventAttributes
  where
  rnf :: ChildWorkflowExecutionCanceledEventAttributes -> ()
rnf
    ChildWorkflowExecutionCanceledEventAttributes' {Integer
Maybe Text
WorkflowExecution
WorkflowType
startedEventId :: Integer
initiatedEventId :: Integer
workflowType :: WorkflowType
workflowExecution :: WorkflowExecution
details :: Maybe Text
$sel:startedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> Integer
$sel:initiatedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> Integer
$sel:workflowType:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> WorkflowType
$sel:workflowExecution:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> WorkflowExecution
$sel:details:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> Maybe Text
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
details
        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