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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SWF.Types.WorkflowExecution

-- | Provides the details of the @ExternalWorkflowExecutionSignaled@ event.
--
-- /See:/ 'newExternalWorkflowExecutionSignaledEventAttributes' smart constructor.
data ExternalWorkflowExecutionSignaledEventAttributes = ExternalWorkflowExecutionSignaledEventAttributes'
  { -- | The external workflow execution that the signal was delivered to.
    ExternalWorkflowExecutionSignaledEventAttributes
-> WorkflowExecution
workflowExecution :: WorkflowExecution,
    -- | The ID of the @SignalExternalWorkflowExecutionInitiated@ event
    -- corresponding to the @SignalExternalWorkflowExecution@ decision to
    -- request this signal. This information can be useful for diagnosing
    -- problems by tracing back the chain of events leading up to this event.
    ExternalWorkflowExecutionSignaledEventAttributes -> Integer
initiatedEventId :: Prelude.Integer
  }
  deriving (ExternalWorkflowExecutionSignaledEventAttributes
-> ExternalWorkflowExecutionSignaledEventAttributes -> Bool
(ExternalWorkflowExecutionSignaledEventAttributes
 -> ExternalWorkflowExecutionSignaledEventAttributes -> Bool)
-> (ExternalWorkflowExecutionSignaledEventAttributes
    -> ExternalWorkflowExecutionSignaledEventAttributes -> Bool)
-> Eq ExternalWorkflowExecutionSignaledEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalWorkflowExecutionSignaledEventAttributes
-> ExternalWorkflowExecutionSignaledEventAttributes -> Bool
$c/= :: ExternalWorkflowExecutionSignaledEventAttributes
-> ExternalWorkflowExecutionSignaledEventAttributes -> Bool
== :: ExternalWorkflowExecutionSignaledEventAttributes
-> ExternalWorkflowExecutionSignaledEventAttributes -> Bool
$c== :: ExternalWorkflowExecutionSignaledEventAttributes
-> ExternalWorkflowExecutionSignaledEventAttributes -> Bool
Prelude.Eq, ReadPrec [ExternalWorkflowExecutionSignaledEventAttributes]
ReadPrec ExternalWorkflowExecutionSignaledEventAttributes
Int -> ReadS ExternalWorkflowExecutionSignaledEventAttributes
ReadS [ExternalWorkflowExecutionSignaledEventAttributes]
(Int -> ReadS ExternalWorkflowExecutionSignaledEventAttributes)
-> ReadS [ExternalWorkflowExecutionSignaledEventAttributes]
-> ReadPrec ExternalWorkflowExecutionSignaledEventAttributes
-> ReadPrec [ExternalWorkflowExecutionSignaledEventAttributes]
-> Read ExternalWorkflowExecutionSignaledEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExternalWorkflowExecutionSignaledEventAttributes]
$creadListPrec :: ReadPrec [ExternalWorkflowExecutionSignaledEventAttributes]
readPrec :: ReadPrec ExternalWorkflowExecutionSignaledEventAttributes
$creadPrec :: ReadPrec ExternalWorkflowExecutionSignaledEventAttributes
readList :: ReadS [ExternalWorkflowExecutionSignaledEventAttributes]
$creadList :: ReadS [ExternalWorkflowExecutionSignaledEventAttributes]
readsPrec :: Int -> ReadS ExternalWorkflowExecutionSignaledEventAttributes
$creadsPrec :: Int -> ReadS ExternalWorkflowExecutionSignaledEventAttributes
Prelude.Read, Int -> ExternalWorkflowExecutionSignaledEventAttributes -> ShowS
[ExternalWorkflowExecutionSignaledEventAttributes] -> ShowS
ExternalWorkflowExecutionSignaledEventAttributes -> String
(Int -> ExternalWorkflowExecutionSignaledEventAttributes -> ShowS)
-> (ExternalWorkflowExecutionSignaledEventAttributes -> String)
-> ([ExternalWorkflowExecutionSignaledEventAttributes] -> ShowS)
-> Show ExternalWorkflowExecutionSignaledEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExternalWorkflowExecutionSignaledEventAttributes] -> ShowS
$cshowList :: [ExternalWorkflowExecutionSignaledEventAttributes] -> ShowS
show :: ExternalWorkflowExecutionSignaledEventAttributes -> String
$cshow :: ExternalWorkflowExecutionSignaledEventAttributes -> String
showsPrec :: Int -> ExternalWorkflowExecutionSignaledEventAttributes -> ShowS
$cshowsPrec :: Int -> ExternalWorkflowExecutionSignaledEventAttributes -> ShowS
Prelude.Show, (forall x.
 ExternalWorkflowExecutionSignaledEventAttributes
 -> Rep ExternalWorkflowExecutionSignaledEventAttributes x)
-> (forall x.
    Rep ExternalWorkflowExecutionSignaledEventAttributes x
    -> ExternalWorkflowExecutionSignaledEventAttributes)
-> Generic ExternalWorkflowExecutionSignaledEventAttributes
forall x.
Rep ExternalWorkflowExecutionSignaledEventAttributes x
-> ExternalWorkflowExecutionSignaledEventAttributes
forall x.
ExternalWorkflowExecutionSignaledEventAttributes
-> Rep ExternalWorkflowExecutionSignaledEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExternalWorkflowExecutionSignaledEventAttributes x
-> ExternalWorkflowExecutionSignaledEventAttributes
$cfrom :: forall x.
ExternalWorkflowExecutionSignaledEventAttributes
-> Rep ExternalWorkflowExecutionSignaledEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ExternalWorkflowExecutionSignaledEventAttributes' 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:
--
-- 'workflowExecution', 'externalWorkflowExecutionSignaledEventAttributes_workflowExecution' - The external workflow execution that the signal was delivered to.
--
-- 'initiatedEventId', 'externalWorkflowExecutionSignaledEventAttributes_initiatedEventId' - The ID of the @SignalExternalWorkflowExecutionInitiated@ event
-- corresponding to the @SignalExternalWorkflowExecution@ decision to
-- request this signal. This information can be useful for diagnosing
-- problems by tracing back the chain of events leading up to this event.
newExternalWorkflowExecutionSignaledEventAttributes ::
  -- | 'workflowExecution'
  WorkflowExecution ->
  -- | 'initiatedEventId'
  Prelude.Integer ->
  ExternalWorkflowExecutionSignaledEventAttributes
newExternalWorkflowExecutionSignaledEventAttributes :: WorkflowExecution
-> Integer -> ExternalWorkflowExecutionSignaledEventAttributes
newExternalWorkflowExecutionSignaledEventAttributes
  WorkflowExecution
pWorkflowExecution_
  Integer
pInitiatedEventId_ =
    ExternalWorkflowExecutionSignaledEventAttributes' :: WorkflowExecution
-> Integer -> ExternalWorkflowExecutionSignaledEventAttributes
ExternalWorkflowExecutionSignaledEventAttributes'
      { $sel:workflowExecution:ExternalWorkflowExecutionSignaledEventAttributes' :: WorkflowExecution
workflowExecution =
          WorkflowExecution
pWorkflowExecution_,
        $sel:initiatedEventId:ExternalWorkflowExecutionSignaledEventAttributes' :: Integer
initiatedEventId =
          Integer
pInitiatedEventId_
      }

-- | The external workflow execution that the signal was delivered to.
externalWorkflowExecutionSignaledEventAttributes_workflowExecution :: Lens.Lens' ExternalWorkflowExecutionSignaledEventAttributes WorkflowExecution
externalWorkflowExecutionSignaledEventAttributes_workflowExecution :: (WorkflowExecution -> f WorkflowExecution)
-> ExternalWorkflowExecutionSignaledEventAttributes
-> f ExternalWorkflowExecutionSignaledEventAttributes
externalWorkflowExecutionSignaledEventAttributes_workflowExecution = (ExternalWorkflowExecutionSignaledEventAttributes
 -> WorkflowExecution)
-> (ExternalWorkflowExecutionSignaledEventAttributes
    -> WorkflowExecution
    -> ExternalWorkflowExecutionSignaledEventAttributes)
-> Lens
     ExternalWorkflowExecutionSignaledEventAttributes
     ExternalWorkflowExecutionSignaledEventAttributes
     WorkflowExecution
     WorkflowExecution
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalWorkflowExecutionSignaledEventAttributes' {WorkflowExecution
workflowExecution :: WorkflowExecution
$sel:workflowExecution:ExternalWorkflowExecutionSignaledEventAttributes' :: ExternalWorkflowExecutionSignaledEventAttributes
-> WorkflowExecution
workflowExecution} -> WorkflowExecution
workflowExecution) (\s :: ExternalWorkflowExecutionSignaledEventAttributes
s@ExternalWorkflowExecutionSignaledEventAttributes' {} WorkflowExecution
a -> ExternalWorkflowExecutionSignaledEventAttributes
s {$sel:workflowExecution:ExternalWorkflowExecutionSignaledEventAttributes' :: WorkflowExecution
workflowExecution = WorkflowExecution
a} :: ExternalWorkflowExecutionSignaledEventAttributes)

-- | The ID of the @SignalExternalWorkflowExecutionInitiated@ event
-- corresponding to the @SignalExternalWorkflowExecution@ decision to
-- request this signal. This information can be useful for diagnosing
-- problems by tracing back the chain of events leading up to this event.
externalWorkflowExecutionSignaledEventAttributes_initiatedEventId :: Lens.Lens' ExternalWorkflowExecutionSignaledEventAttributes Prelude.Integer
externalWorkflowExecutionSignaledEventAttributes_initiatedEventId :: (Integer -> f Integer)
-> ExternalWorkflowExecutionSignaledEventAttributes
-> f ExternalWorkflowExecutionSignaledEventAttributes
externalWorkflowExecutionSignaledEventAttributes_initiatedEventId = (ExternalWorkflowExecutionSignaledEventAttributes -> Integer)
-> (ExternalWorkflowExecutionSignaledEventAttributes
    -> Integer -> ExternalWorkflowExecutionSignaledEventAttributes)
-> Lens
     ExternalWorkflowExecutionSignaledEventAttributes
     ExternalWorkflowExecutionSignaledEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalWorkflowExecutionSignaledEventAttributes' {Integer
initiatedEventId :: Integer
$sel:initiatedEventId:ExternalWorkflowExecutionSignaledEventAttributes' :: ExternalWorkflowExecutionSignaledEventAttributes -> Integer
initiatedEventId} -> Integer
initiatedEventId) (\s :: ExternalWorkflowExecutionSignaledEventAttributes
s@ExternalWorkflowExecutionSignaledEventAttributes' {} Integer
a -> ExternalWorkflowExecutionSignaledEventAttributes
s {$sel:initiatedEventId:ExternalWorkflowExecutionSignaledEventAttributes' :: Integer
initiatedEventId = Integer
a} :: ExternalWorkflowExecutionSignaledEventAttributes)

instance
  Core.FromJSON
    ExternalWorkflowExecutionSignaledEventAttributes
  where
  parseJSON :: Value -> Parser ExternalWorkflowExecutionSignaledEventAttributes
parseJSON =
    String
-> (Object
    -> Parser ExternalWorkflowExecutionSignaledEventAttributes)
-> Value
-> Parser ExternalWorkflowExecutionSignaledEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExternalWorkflowExecutionSignaledEventAttributes"
      ( \Object
x ->
          WorkflowExecution
-> Integer -> ExternalWorkflowExecutionSignaledEventAttributes
ExternalWorkflowExecutionSignaledEventAttributes'
            (WorkflowExecution
 -> Integer -> ExternalWorkflowExecutionSignaledEventAttributes)
-> Parser WorkflowExecution
-> Parser
     (Integer -> ExternalWorkflowExecutionSignaledEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser WorkflowExecution
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"workflowExecution")
              Parser
  (Integer -> ExternalWorkflowExecutionSignaledEventAttributes)
-> Parser Integer
-> Parser ExternalWorkflowExecutionSignaledEventAttributes
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
"initiatedEventId")
      )

instance
  Prelude.Hashable
    ExternalWorkflowExecutionSignaledEventAttributes

instance
  Prelude.NFData
    ExternalWorkflowExecutionSignaledEventAttributes