{-# 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.WorkflowExecutionCompletedEventAttributes
-- 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.WorkflowExecutionCompletedEventAttributes 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 @WorkflowExecutionCompleted@ event.
--
-- /See:/ 'newWorkflowExecutionCompletedEventAttributes' smart constructor.
data WorkflowExecutionCompletedEventAttributes = WorkflowExecutionCompletedEventAttributes'
  { -- | The result produced by the workflow execution upon successful
    -- completion.
    WorkflowExecutionCompletedEventAttributes -> Maybe Text
result :: Prelude.Maybe Prelude.Text,
    -- | The ID of the @DecisionTaskCompleted@ event corresponding to the
    -- decision task that resulted in the @CompleteWorkflowExecution@ decision
    -- to complete this execution. This information can be useful for
    -- diagnosing problems by tracing back the chain of events leading up to
    -- this event.
    WorkflowExecutionCompletedEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (WorkflowExecutionCompletedEventAttributes
-> WorkflowExecutionCompletedEventAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowExecutionCompletedEventAttributes
-> WorkflowExecutionCompletedEventAttributes -> Bool
$c/= :: WorkflowExecutionCompletedEventAttributes
-> WorkflowExecutionCompletedEventAttributes -> Bool
== :: WorkflowExecutionCompletedEventAttributes
-> WorkflowExecutionCompletedEventAttributes -> Bool
$c== :: WorkflowExecutionCompletedEventAttributes
-> WorkflowExecutionCompletedEventAttributes -> Bool
Prelude.Eq, ReadPrec [WorkflowExecutionCompletedEventAttributes]
ReadPrec WorkflowExecutionCompletedEventAttributes
Int -> ReadS WorkflowExecutionCompletedEventAttributes
ReadS [WorkflowExecutionCompletedEventAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowExecutionCompletedEventAttributes]
$creadListPrec :: ReadPrec [WorkflowExecutionCompletedEventAttributes]
readPrec :: ReadPrec WorkflowExecutionCompletedEventAttributes
$creadPrec :: ReadPrec WorkflowExecutionCompletedEventAttributes
readList :: ReadS [WorkflowExecutionCompletedEventAttributes]
$creadList :: ReadS [WorkflowExecutionCompletedEventAttributes]
readsPrec :: Int -> ReadS WorkflowExecutionCompletedEventAttributes
$creadsPrec :: Int -> ReadS WorkflowExecutionCompletedEventAttributes
Prelude.Read, Int -> WorkflowExecutionCompletedEventAttributes -> ShowS
[WorkflowExecutionCompletedEventAttributes] -> ShowS
WorkflowExecutionCompletedEventAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowExecutionCompletedEventAttributes] -> ShowS
$cshowList :: [WorkflowExecutionCompletedEventAttributes] -> ShowS
show :: WorkflowExecutionCompletedEventAttributes -> String
$cshow :: WorkflowExecutionCompletedEventAttributes -> String
showsPrec :: Int -> WorkflowExecutionCompletedEventAttributes -> ShowS
$cshowsPrec :: Int -> WorkflowExecutionCompletedEventAttributes -> ShowS
Prelude.Show, forall x.
Rep WorkflowExecutionCompletedEventAttributes x
-> WorkflowExecutionCompletedEventAttributes
forall x.
WorkflowExecutionCompletedEventAttributes
-> Rep WorkflowExecutionCompletedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkflowExecutionCompletedEventAttributes x
-> WorkflowExecutionCompletedEventAttributes
$cfrom :: forall x.
WorkflowExecutionCompletedEventAttributes
-> Rep WorkflowExecutionCompletedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowExecutionCompletedEventAttributes' 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:
--
-- 'result', 'workflowExecutionCompletedEventAttributes_result' - The result produced by the workflow execution upon successful
-- completion.
--
-- 'decisionTaskCompletedEventId', 'workflowExecutionCompletedEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @CompleteWorkflowExecution@ decision
-- to complete this execution. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
newWorkflowExecutionCompletedEventAttributes ::
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  WorkflowExecutionCompletedEventAttributes
newWorkflowExecutionCompletedEventAttributes :: Integer -> WorkflowExecutionCompletedEventAttributes
newWorkflowExecutionCompletedEventAttributes
  Integer
pDecisionTaskCompletedEventId_ =
    WorkflowExecutionCompletedEventAttributes'
      { $sel:result:WorkflowExecutionCompletedEventAttributes' :: Maybe Text
result =
          forall a. Maybe a
Prelude.Nothing,
        $sel:decisionTaskCompletedEventId:WorkflowExecutionCompletedEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

-- | The result produced by the workflow execution upon successful
-- completion.
workflowExecutionCompletedEventAttributes_result :: Lens.Lens' WorkflowExecutionCompletedEventAttributes (Prelude.Maybe Prelude.Text)
workflowExecutionCompletedEventAttributes_result :: Lens' WorkflowExecutionCompletedEventAttributes (Maybe Text)
workflowExecutionCompletedEventAttributes_result = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionCompletedEventAttributes' {Maybe Text
result :: Maybe Text
$sel:result:WorkflowExecutionCompletedEventAttributes' :: WorkflowExecutionCompletedEventAttributes -> Maybe Text
result} -> Maybe Text
result) (\s :: WorkflowExecutionCompletedEventAttributes
s@WorkflowExecutionCompletedEventAttributes' {} Maybe Text
a -> WorkflowExecutionCompletedEventAttributes
s {$sel:result:WorkflowExecutionCompletedEventAttributes' :: Maybe Text
result = Maybe Text
a} :: WorkflowExecutionCompletedEventAttributes)

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

instance
  Data.FromJSON
    WorkflowExecutionCompletedEventAttributes
  where
  parseJSON :: Value -> Parser WorkflowExecutionCompletedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkflowExecutionCompletedEventAttributes"
      ( \Object
x ->
          Maybe Text -> Integer -> WorkflowExecutionCompletedEventAttributes
WorkflowExecutionCompletedEventAttributes'
            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
"result")
            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
    WorkflowExecutionCompletedEventAttributes
  where
  hashWithSalt :: Int -> WorkflowExecutionCompletedEventAttributes -> Int
hashWithSalt
    Int
_salt
    WorkflowExecutionCompletedEventAttributes' {Integer
Maybe Text
decisionTaskCompletedEventId :: Integer
result :: Maybe Text
$sel:decisionTaskCompletedEventId:WorkflowExecutionCompletedEventAttributes' :: WorkflowExecutionCompletedEventAttributes -> Integer
$sel:result:WorkflowExecutionCompletedEventAttributes' :: WorkflowExecutionCompletedEventAttributes -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
result
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
decisionTaskCompletedEventId

instance
  Prelude.NFData
    WorkflowExecutionCompletedEventAttributes
  where
  rnf :: WorkflowExecutionCompletedEventAttributes -> ()
rnf WorkflowExecutionCompletedEventAttributes' {Integer
Maybe Text
decisionTaskCompletedEventId :: Integer
result :: Maybe Text
$sel:decisionTaskCompletedEventId:WorkflowExecutionCompletedEventAttributes' :: WorkflowExecutionCompletedEventAttributes -> Integer
$sel:result:WorkflowExecutionCompletedEventAttributes' :: WorkflowExecutionCompletedEventAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
result
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
decisionTaskCompletedEventId