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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(WorkflowExecutionCompletedEventAttributes
 -> WorkflowExecutionCompletedEventAttributes -> Bool)
-> (WorkflowExecutionCompletedEventAttributes
    -> WorkflowExecutionCompletedEventAttributes -> Bool)
-> Eq WorkflowExecutionCompletedEventAttributes
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]
(Int -> ReadS WorkflowExecutionCompletedEventAttributes)
-> ReadS [WorkflowExecutionCompletedEventAttributes]
-> ReadPrec WorkflowExecutionCompletedEventAttributes
-> ReadPrec [WorkflowExecutionCompletedEventAttributes]
-> Read 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
(Int -> WorkflowExecutionCompletedEventAttributes -> ShowS)
-> (WorkflowExecutionCompletedEventAttributes -> String)
-> ([WorkflowExecutionCompletedEventAttributes] -> ShowS)
-> Show WorkflowExecutionCompletedEventAttributes
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.
 WorkflowExecutionCompletedEventAttributes
 -> Rep WorkflowExecutionCompletedEventAttributes x)
-> (forall x.
    Rep WorkflowExecutionCompletedEventAttributes x
    -> WorkflowExecutionCompletedEventAttributes)
-> Generic WorkflowExecutionCompletedEventAttributes
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' :: Maybe Text -> Integer -> WorkflowExecutionCompletedEventAttributes
WorkflowExecutionCompletedEventAttributes'
      { $sel:result:WorkflowExecutionCompletedEventAttributes' :: Maybe Text
result =
          Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> WorkflowExecutionCompletedEventAttributes
-> f WorkflowExecutionCompletedEventAttributes
workflowExecutionCompletedEventAttributes_result = (WorkflowExecutionCompletedEventAttributes -> Maybe Text)
-> (WorkflowExecutionCompletedEventAttributes
    -> Maybe Text -> WorkflowExecutionCompletedEventAttributes)
-> Lens
     WorkflowExecutionCompletedEventAttributes
     WorkflowExecutionCompletedEventAttributes
     (Maybe Text)
     (Maybe Text)
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 :: (Integer -> f Integer)
-> WorkflowExecutionCompletedEventAttributes
-> f WorkflowExecutionCompletedEventAttributes
workflowExecutionCompletedEventAttributes_decisionTaskCompletedEventId = (WorkflowExecutionCompletedEventAttributes -> Integer)
-> (WorkflowExecutionCompletedEventAttributes
    -> Integer -> WorkflowExecutionCompletedEventAttributes)
-> Lens
     WorkflowExecutionCompletedEventAttributes
     WorkflowExecutionCompletedEventAttributes
     Integer
     Integer
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
  Core.FromJSON
    WorkflowExecutionCompletedEventAttributes
  where
  parseJSON :: Value -> Parser WorkflowExecutionCompletedEventAttributes
parseJSON =
    String
-> (Object -> Parser WorkflowExecutionCompletedEventAttributes)
-> Value
-> Parser WorkflowExecutionCompletedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkflowExecutionCompletedEventAttributes"
      ( \Object
x ->
          Maybe Text -> Integer -> WorkflowExecutionCompletedEventAttributes
WorkflowExecutionCompletedEventAttributes'
            (Maybe Text
 -> Integer -> WorkflowExecutionCompletedEventAttributes)
-> Parser (Maybe Text)
-> Parser (Integer -> WorkflowExecutionCompletedEventAttributes)
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
"result")
              Parser (Integer -> WorkflowExecutionCompletedEventAttributes)
-> Parser Integer
-> Parser WorkflowExecutionCompletedEventAttributes
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
    WorkflowExecutionCompletedEventAttributes

instance
  Prelude.NFData
    WorkflowExecutionCompletedEventAttributes