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

-- | Provides the details of the @WorkflowExecutionCanceled@ event.
--
-- /See:/ 'newWorkflowExecutionCanceledEventAttributes' smart constructor.
data WorkflowExecutionCanceledEventAttributes = WorkflowExecutionCanceledEventAttributes'
  { -- | The details of the cancellation.
    WorkflowExecutionCanceledEventAttributes -> Maybe Text
details :: Prelude.Maybe Prelude.Text,
    -- | The ID of the @DecisionTaskCompleted@ event corresponding to the
    -- decision task that resulted in the @CancelWorkflowExecution@ decision
    -- for this cancellation request. This information can be useful for
    -- diagnosing problems by tracing back the chain of events leading up to
    -- this event.
    WorkflowExecutionCanceledEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (WorkflowExecutionCanceledEventAttributes
-> WorkflowExecutionCanceledEventAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowExecutionCanceledEventAttributes
-> WorkflowExecutionCanceledEventAttributes -> Bool
$c/= :: WorkflowExecutionCanceledEventAttributes
-> WorkflowExecutionCanceledEventAttributes -> Bool
== :: WorkflowExecutionCanceledEventAttributes
-> WorkflowExecutionCanceledEventAttributes -> Bool
$c== :: WorkflowExecutionCanceledEventAttributes
-> WorkflowExecutionCanceledEventAttributes -> Bool
Prelude.Eq, ReadPrec [WorkflowExecutionCanceledEventAttributes]
ReadPrec WorkflowExecutionCanceledEventAttributes
Int -> ReadS WorkflowExecutionCanceledEventAttributes
ReadS [WorkflowExecutionCanceledEventAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowExecutionCanceledEventAttributes]
$creadListPrec :: ReadPrec [WorkflowExecutionCanceledEventAttributes]
readPrec :: ReadPrec WorkflowExecutionCanceledEventAttributes
$creadPrec :: ReadPrec WorkflowExecutionCanceledEventAttributes
readList :: ReadS [WorkflowExecutionCanceledEventAttributes]
$creadList :: ReadS [WorkflowExecutionCanceledEventAttributes]
readsPrec :: Int -> ReadS WorkflowExecutionCanceledEventAttributes
$creadsPrec :: Int -> ReadS WorkflowExecutionCanceledEventAttributes
Prelude.Read, Int -> WorkflowExecutionCanceledEventAttributes -> ShowS
[WorkflowExecutionCanceledEventAttributes] -> ShowS
WorkflowExecutionCanceledEventAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowExecutionCanceledEventAttributes] -> ShowS
$cshowList :: [WorkflowExecutionCanceledEventAttributes] -> ShowS
show :: WorkflowExecutionCanceledEventAttributes -> String
$cshow :: WorkflowExecutionCanceledEventAttributes -> String
showsPrec :: Int -> WorkflowExecutionCanceledEventAttributes -> ShowS
$cshowsPrec :: Int -> WorkflowExecutionCanceledEventAttributes -> ShowS
Prelude.Show, forall x.
Rep WorkflowExecutionCanceledEventAttributes x
-> WorkflowExecutionCanceledEventAttributes
forall x.
WorkflowExecutionCanceledEventAttributes
-> Rep WorkflowExecutionCanceledEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkflowExecutionCanceledEventAttributes x
-> WorkflowExecutionCanceledEventAttributes
$cfrom :: forall x.
WorkflowExecutionCanceledEventAttributes
-> Rep WorkflowExecutionCanceledEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowExecutionCanceledEventAttributes' 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', 'workflowExecutionCanceledEventAttributes_details' - The details of the cancellation.
--
-- 'decisionTaskCompletedEventId', 'workflowExecutionCanceledEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @CancelWorkflowExecution@ decision
-- for this cancellation request. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
newWorkflowExecutionCanceledEventAttributes ::
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  WorkflowExecutionCanceledEventAttributes
newWorkflowExecutionCanceledEventAttributes :: Integer -> WorkflowExecutionCanceledEventAttributes
newWorkflowExecutionCanceledEventAttributes
  Integer
pDecisionTaskCompletedEventId_ =
    WorkflowExecutionCanceledEventAttributes'
      { $sel:details:WorkflowExecutionCanceledEventAttributes' :: Maybe Text
details =
          forall a. Maybe a
Prelude.Nothing,
        $sel:decisionTaskCompletedEventId:WorkflowExecutionCanceledEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

-- | The details of the cancellation.
workflowExecutionCanceledEventAttributes_details :: Lens.Lens' WorkflowExecutionCanceledEventAttributes (Prelude.Maybe Prelude.Text)
workflowExecutionCanceledEventAttributes_details :: Lens' WorkflowExecutionCanceledEventAttributes (Maybe Text)
workflowExecutionCanceledEventAttributes_details = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionCanceledEventAttributes' {Maybe Text
details :: Maybe Text
$sel:details:WorkflowExecutionCanceledEventAttributes' :: WorkflowExecutionCanceledEventAttributes -> Maybe Text
details} -> Maybe Text
details) (\s :: WorkflowExecutionCanceledEventAttributes
s@WorkflowExecutionCanceledEventAttributes' {} Maybe Text
a -> WorkflowExecutionCanceledEventAttributes
s {$sel:details:WorkflowExecutionCanceledEventAttributes' :: Maybe Text
details = Maybe Text
a} :: WorkflowExecutionCanceledEventAttributes)

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @CancelWorkflowExecution@ decision
-- for this cancellation request. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
workflowExecutionCanceledEventAttributes_decisionTaskCompletedEventId :: Lens.Lens' WorkflowExecutionCanceledEventAttributes Prelude.Integer
workflowExecutionCanceledEventAttributes_decisionTaskCompletedEventId :: Lens' WorkflowExecutionCanceledEventAttributes Integer
workflowExecutionCanceledEventAttributes_decisionTaskCompletedEventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionCanceledEventAttributes' {Integer
decisionTaskCompletedEventId :: Integer
$sel:decisionTaskCompletedEventId:WorkflowExecutionCanceledEventAttributes' :: WorkflowExecutionCanceledEventAttributes -> Integer
decisionTaskCompletedEventId} -> Integer
decisionTaskCompletedEventId) (\s :: WorkflowExecutionCanceledEventAttributes
s@WorkflowExecutionCanceledEventAttributes' {} Integer
a -> WorkflowExecutionCanceledEventAttributes
s {$sel:decisionTaskCompletedEventId:WorkflowExecutionCanceledEventAttributes' :: Integer
decisionTaskCompletedEventId = Integer
a} :: WorkflowExecutionCanceledEventAttributes)

instance
  Data.FromJSON
    WorkflowExecutionCanceledEventAttributes
  where
  parseJSON :: Value -> Parser WorkflowExecutionCanceledEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkflowExecutionCanceledEventAttributes"
      ( \Object
x ->
          Maybe Text -> Integer -> WorkflowExecutionCanceledEventAttributes
WorkflowExecutionCanceledEventAttributes'
            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
"decisionTaskCompletedEventId")
      )

instance
  Prelude.Hashable
    WorkflowExecutionCanceledEventAttributes
  where
  hashWithSalt :: Int -> WorkflowExecutionCanceledEventAttributes -> Int
hashWithSalt
    Int
_salt
    WorkflowExecutionCanceledEventAttributes' {Integer
Maybe Text
decisionTaskCompletedEventId :: Integer
details :: Maybe Text
$sel:decisionTaskCompletedEventId:WorkflowExecutionCanceledEventAttributes' :: WorkflowExecutionCanceledEventAttributes -> Integer
$sel:details:WorkflowExecutionCanceledEventAttributes' :: WorkflowExecutionCanceledEventAttributes -> 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` Integer
decisionTaskCompletedEventId

instance
  Prelude.NFData
    WorkflowExecutionCanceledEventAttributes
  where
  rnf :: WorkflowExecutionCanceledEventAttributes -> ()
rnf WorkflowExecutionCanceledEventAttributes' {Integer
Maybe Text
decisionTaskCompletedEventId :: Integer
details :: Maybe Text
$sel:decisionTaskCompletedEventId:WorkflowExecutionCanceledEventAttributes' :: WorkflowExecutionCanceledEventAttributes -> Integer
$sel:details:WorkflowExecutionCanceledEventAttributes' :: WorkflowExecutionCanceledEventAttributes -> 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 Integer
decisionTaskCompletedEventId