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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(WorkflowExecutionCanceledEventAttributes
 -> WorkflowExecutionCanceledEventAttributes -> Bool)
-> (WorkflowExecutionCanceledEventAttributes
    -> WorkflowExecutionCanceledEventAttributes -> Bool)
-> Eq WorkflowExecutionCanceledEventAttributes
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]
(Int -> ReadS WorkflowExecutionCanceledEventAttributes)
-> ReadS [WorkflowExecutionCanceledEventAttributes]
-> ReadPrec WorkflowExecutionCanceledEventAttributes
-> ReadPrec [WorkflowExecutionCanceledEventAttributes]
-> Read 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
(Int -> WorkflowExecutionCanceledEventAttributes -> ShowS)
-> (WorkflowExecutionCanceledEventAttributes -> String)
-> ([WorkflowExecutionCanceledEventAttributes] -> ShowS)
-> Show WorkflowExecutionCanceledEventAttributes
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.
 WorkflowExecutionCanceledEventAttributes
 -> Rep WorkflowExecutionCanceledEventAttributes x)
-> (forall x.
    Rep WorkflowExecutionCanceledEventAttributes x
    -> WorkflowExecutionCanceledEventAttributes)
-> Generic WorkflowExecutionCanceledEventAttributes
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' :: Maybe Text -> Integer -> WorkflowExecutionCanceledEventAttributes
WorkflowExecutionCanceledEventAttributes'
      { $sel:details:WorkflowExecutionCanceledEventAttributes' :: Maybe Text
details =
          Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> WorkflowExecutionCanceledEventAttributes
-> f WorkflowExecutionCanceledEventAttributes
workflowExecutionCanceledEventAttributes_details = (WorkflowExecutionCanceledEventAttributes -> Maybe Text)
-> (WorkflowExecutionCanceledEventAttributes
    -> Maybe Text -> WorkflowExecutionCanceledEventAttributes)
-> Lens
     WorkflowExecutionCanceledEventAttributes
     WorkflowExecutionCanceledEventAttributes
     (Maybe Text)
     (Maybe Text)
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 :: (Integer -> f Integer)
-> WorkflowExecutionCanceledEventAttributes
-> f WorkflowExecutionCanceledEventAttributes
workflowExecutionCanceledEventAttributes_decisionTaskCompletedEventId = (WorkflowExecutionCanceledEventAttributes -> Integer)
-> (WorkflowExecutionCanceledEventAttributes
    -> Integer -> WorkflowExecutionCanceledEventAttributes)
-> Lens
     WorkflowExecutionCanceledEventAttributes
     WorkflowExecutionCanceledEventAttributes
     Integer
     Integer
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
  Core.FromJSON
    WorkflowExecutionCanceledEventAttributes
  where
  parseJSON :: Value -> Parser WorkflowExecutionCanceledEventAttributes
parseJSON =
    String
-> (Object -> Parser WorkflowExecutionCanceledEventAttributes)
-> Value
-> Parser WorkflowExecutionCanceledEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkflowExecutionCanceledEventAttributes"
      ( \Object
x ->
          Maybe Text -> Integer -> WorkflowExecutionCanceledEventAttributes
WorkflowExecutionCanceledEventAttributes'
            (Maybe Text -> Integer -> WorkflowExecutionCanceledEventAttributes)
-> Parser (Maybe Text)
-> Parser (Integer -> WorkflowExecutionCanceledEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"details")
            Parser (Integer -> WorkflowExecutionCanceledEventAttributes)
-> Parser Integer
-> Parser WorkflowExecutionCanceledEventAttributes
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
"decisionTaskCompletedEventId")
      )

instance
  Prelude.Hashable
    WorkflowExecutionCanceledEventAttributes

instance
  Prelude.NFData
    WorkflowExecutionCanceledEventAttributes