{-# 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.WorkflowExecutionSignaledEventAttributes
-- 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.WorkflowExecutionSignaledEventAttributes 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
import Amazonka.SWF.Types.WorkflowExecution

-- | Provides the details of the @WorkflowExecutionSignaled@ event.
--
-- /See:/ 'newWorkflowExecutionSignaledEventAttributes' smart constructor.
data WorkflowExecutionSignaledEventAttributes = WorkflowExecutionSignaledEventAttributes'
  { -- | The ID of the @SignalExternalWorkflowExecutionInitiated@ event
    -- corresponding to the @SignalExternalWorkflow@ decision to signal this
    -- workflow execution.The source event with this ID can be found in the
    -- history of the source workflow execution. This information can be useful
    -- for diagnosing problems by tracing back the chain of events leading up
    -- to this event. This field is set only if the signal was initiated by
    -- another workflow execution.
    WorkflowExecutionSignaledEventAttributes -> Maybe Integer
externalInitiatedEventId :: Prelude.Maybe Prelude.Integer,
    -- | The workflow execution that sent the signal. This is set only of the
    -- signal was sent by another workflow execution.
    WorkflowExecutionSignaledEventAttributes -> Maybe WorkflowExecution
externalWorkflowExecution :: Prelude.Maybe WorkflowExecution,
    -- | The inputs provided with the signal. The decider can use the signal name
    -- and inputs to determine how to process the signal.
    WorkflowExecutionSignaledEventAttributes -> Maybe Text
input :: Prelude.Maybe Prelude.Text,
    -- | The name of the signal received. The decider can use the signal name and
    -- inputs to determine how to the process the signal.
    WorkflowExecutionSignaledEventAttributes -> Text
signalName :: Prelude.Text
  }
  deriving (WorkflowExecutionSignaledEventAttributes
-> WorkflowExecutionSignaledEventAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowExecutionSignaledEventAttributes
-> WorkflowExecutionSignaledEventAttributes -> Bool
$c/= :: WorkflowExecutionSignaledEventAttributes
-> WorkflowExecutionSignaledEventAttributes -> Bool
== :: WorkflowExecutionSignaledEventAttributes
-> WorkflowExecutionSignaledEventAttributes -> Bool
$c== :: WorkflowExecutionSignaledEventAttributes
-> WorkflowExecutionSignaledEventAttributes -> Bool
Prelude.Eq, ReadPrec [WorkflowExecutionSignaledEventAttributes]
ReadPrec WorkflowExecutionSignaledEventAttributes
Int -> ReadS WorkflowExecutionSignaledEventAttributes
ReadS [WorkflowExecutionSignaledEventAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowExecutionSignaledEventAttributes]
$creadListPrec :: ReadPrec [WorkflowExecutionSignaledEventAttributes]
readPrec :: ReadPrec WorkflowExecutionSignaledEventAttributes
$creadPrec :: ReadPrec WorkflowExecutionSignaledEventAttributes
readList :: ReadS [WorkflowExecutionSignaledEventAttributes]
$creadList :: ReadS [WorkflowExecutionSignaledEventAttributes]
readsPrec :: Int -> ReadS WorkflowExecutionSignaledEventAttributes
$creadsPrec :: Int -> ReadS WorkflowExecutionSignaledEventAttributes
Prelude.Read, Int -> WorkflowExecutionSignaledEventAttributes -> ShowS
[WorkflowExecutionSignaledEventAttributes] -> ShowS
WorkflowExecutionSignaledEventAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowExecutionSignaledEventAttributes] -> ShowS
$cshowList :: [WorkflowExecutionSignaledEventAttributes] -> ShowS
show :: WorkflowExecutionSignaledEventAttributes -> String
$cshow :: WorkflowExecutionSignaledEventAttributes -> String
showsPrec :: Int -> WorkflowExecutionSignaledEventAttributes -> ShowS
$cshowsPrec :: Int -> WorkflowExecutionSignaledEventAttributes -> ShowS
Prelude.Show, forall x.
Rep WorkflowExecutionSignaledEventAttributes x
-> WorkflowExecutionSignaledEventAttributes
forall x.
WorkflowExecutionSignaledEventAttributes
-> Rep WorkflowExecutionSignaledEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkflowExecutionSignaledEventAttributes x
-> WorkflowExecutionSignaledEventAttributes
$cfrom :: forall x.
WorkflowExecutionSignaledEventAttributes
-> Rep WorkflowExecutionSignaledEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowExecutionSignaledEventAttributes' 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:
--
-- 'externalInitiatedEventId', 'workflowExecutionSignaledEventAttributes_externalInitiatedEventId' - The ID of the @SignalExternalWorkflowExecutionInitiated@ event
-- corresponding to the @SignalExternalWorkflow@ decision to signal this
-- workflow execution.The source event with this ID can be found in the
-- history of the source workflow execution. This information can be useful
-- for diagnosing problems by tracing back the chain of events leading up
-- to this event. This field is set only if the signal was initiated by
-- another workflow execution.
--
-- 'externalWorkflowExecution', 'workflowExecutionSignaledEventAttributes_externalWorkflowExecution' - The workflow execution that sent the signal. This is set only of the
-- signal was sent by another workflow execution.
--
-- 'input', 'workflowExecutionSignaledEventAttributes_input' - The inputs provided with the signal. The decider can use the signal name
-- and inputs to determine how to process the signal.
--
-- 'signalName', 'workflowExecutionSignaledEventAttributes_signalName' - The name of the signal received. The decider can use the signal name and
-- inputs to determine how to the process the signal.
newWorkflowExecutionSignaledEventAttributes ::
  -- | 'signalName'
  Prelude.Text ->
  WorkflowExecutionSignaledEventAttributes
newWorkflowExecutionSignaledEventAttributes :: Text -> WorkflowExecutionSignaledEventAttributes
newWorkflowExecutionSignaledEventAttributes
  Text
pSignalName_ =
    WorkflowExecutionSignaledEventAttributes'
      { $sel:externalInitiatedEventId:WorkflowExecutionSignaledEventAttributes' :: Maybe Integer
externalInitiatedEventId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:externalWorkflowExecution:WorkflowExecutionSignaledEventAttributes' :: Maybe WorkflowExecution
externalWorkflowExecution =
          forall a. Maybe a
Prelude.Nothing,
        $sel:input:WorkflowExecutionSignaledEventAttributes' :: Maybe Text
input = forall a. Maybe a
Prelude.Nothing,
        $sel:signalName:WorkflowExecutionSignaledEventAttributes' :: Text
signalName = Text
pSignalName_
      }

-- | The ID of the @SignalExternalWorkflowExecutionInitiated@ event
-- corresponding to the @SignalExternalWorkflow@ decision to signal this
-- workflow execution.The source event with this ID can be found in the
-- history of the source workflow execution. This information can be useful
-- for diagnosing problems by tracing back the chain of events leading up
-- to this event. This field is set only if the signal was initiated by
-- another workflow execution.
workflowExecutionSignaledEventAttributes_externalInitiatedEventId :: Lens.Lens' WorkflowExecutionSignaledEventAttributes (Prelude.Maybe Prelude.Integer)
workflowExecutionSignaledEventAttributes_externalInitiatedEventId :: Lens' WorkflowExecutionSignaledEventAttributes (Maybe Integer)
workflowExecutionSignaledEventAttributes_externalInitiatedEventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionSignaledEventAttributes' {Maybe Integer
externalInitiatedEventId :: Maybe Integer
$sel:externalInitiatedEventId:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe Integer
externalInitiatedEventId} -> Maybe Integer
externalInitiatedEventId) (\s :: WorkflowExecutionSignaledEventAttributes
s@WorkflowExecutionSignaledEventAttributes' {} Maybe Integer
a -> WorkflowExecutionSignaledEventAttributes
s {$sel:externalInitiatedEventId:WorkflowExecutionSignaledEventAttributes' :: Maybe Integer
externalInitiatedEventId = Maybe Integer
a} :: WorkflowExecutionSignaledEventAttributes)

-- | The workflow execution that sent the signal. This is set only of the
-- signal was sent by another workflow execution.
workflowExecutionSignaledEventAttributes_externalWorkflowExecution :: Lens.Lens' WorkflowExecutionSignaledEventAttributes (Prelude.Maybe WorkflowExecution)
workflowExecutionSignaledEventAttributes_externalWorkflowExecution :: Lens'
  WorkflowExecutionSignaledEventAttributes (Maybe WorkflowExecution)
workflowExecutionSignaledEventAttributes_externalWorkflowExecution = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionSignaledEventAttributes' {Maybe WorkflowExecution
externalWorkflowExecution :: Maybe WorkflowExecution
$sel:externalWorkflowExecution:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe WorkflowExecution
externalWorkflowExecution} -> Maybe WorkflowExecution
externalWorkflowExecution) (\s :: WorkflowExecutionSignaledEventAttributes
s@WorkflowExecutionSignaledEventAttributes' {} Maybe WorkflowExecution
a -> WorkflowExecutionSignaledEventAttributes
s {$sel:externalWorkflowExecution:WorkflowExecutionSignaledEventAttributes' :: Maybe WorkflowExecution
externalWorkflowExecution = Maybe WorkflowExecution
a} :: WorkflowExecutionSignaledEventAttributes)

-- | The inputs provided with the signal. The decider can use the signal name
-- and inputs to determine how to process the signal.
workflowExecutionSignaledEventAttributes_input :: Lens.Lens' WorkflowExecutionSignaledEventAttributes (Prelude.Maybe Prelude.Text)
workflowExecutionSignaledEventAttributes_input :: Lens' WorkflowExecutionSignaledEventAttributes (Maybe Text)
workflowExecutionSignaledEventAttributes_input = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionSignaledEventAttributes' {Maybe Text
input :: Maybe Text
$sel:input:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe Text
input} -> Maybe Text
input) (\s :: WorkflowExecutionSignaledEventAttributes
s@WorkflowExecutionSignaledEventAttributes' {} Maybe Text
a -> WorkflowExecutionSignaledEventAttributes
s {$sel:input:WorkflowExecutionSignaledEventAttributes' :: Maybe Text
input = Maybe Text
a} :: WorkflowExecutionSignaledEventAttributes)

-- | The name of the signal received. The decider can use the signal name and
-- inputs to determine how to the process the signal.
workflowExecutionSignaledEventAttributes_signalName :: Lens.Lens' WorkflowExecutionSignaledEventAttributes Prelude.Text
workflowExecutionSignaledEventAttributes_signalName :: Lens' WorkflowExecutionSignaledEventAttributes Text
workflowExecutionSignaledEventAttributes_signalName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionSignaledEventAttributes' {Text
signalName :: Text
$sel:signalName:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Text
signalName} -> Text
signalName) (\s :: WorkflowExecutionSignaledEventAttributes
s@WorkflowExecutionSignaledEventAttributes' {} Text
a -> WorkflowExecutionSignaledEventAttributes
s {$sel:signalName:WorkflowExecutionSignaledEventAttributes' :: Text
signalName = Text
a} :: WorkflowExecutionSignaledEventAttributes)

instance
  Data.FromJSON
    WorkflowExecutionSignaledEventAttributes
  where
  parseJSON :: Value -> Parser WorkflowExecutionSignaledEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkflowExecutionSignaledEventAttributes"
      ( \Object
x ->
          Maybe Integer
-> Maybe WorkflowExecution
-> Maybe Text
-> Text
-> WorkflowExecutionSignaledEventAttributes
WorkflowExecutionSignaledEventAttributes'
            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
"externalInitiatedEventId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"externalWorkflowExecution")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"input")
            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
"signalName")
      )

instance
  Prelude.Hashable
    WorkflowExecutionSignaledEventAttributes
  where
  hashWithSalt :: Int -> WorkflowExecutionSignaledEventAttributes -> Int
hashWithSalt
    Int
_salt
    WorkflowExecutionSignaledEventAttributes' {Maybe Integer
Maybe Text
Maybe WorkflowExecution
Text
signalName :: Text
input :: Maybe Text
externalWorkflowExecution :: Maybe WorkflowExecution
externalInitiatedEventId :: Maybe Integer
$sel:signalName:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Text
$sel:input:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe Text
$sel:externalWorkflowExecution:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe WorkflowExecution
$sel:externalInitiatedEventId:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe Integer
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
externalInitiatedEventId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe WorkflowExecution
externalWorkflowExecution
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
input
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
signalName

instance
  Prelude.NFData
    WorkflowExecutionSignaledEventAttributes
  where
  rnf :: WorkflowExecutionSignaledEventAttributes -> ()
rnf WorkflowExecutionSignaledEventAttributes' {Maybe Integer
Maybe Text
Maybe WorkflowExecution
Text
signalName :: Text
input :: Maybe Text
externalWorkflowExecution :: Maybe WorkflowExecution
externalInitiatedEventId :: Maybe Integer
$sel:signalName:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Text
$sel:input:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe Text
$sel:externalWorkflowExecution:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe WorkflowExecution
$sel:externalInitiatedEventId:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
externalInitiatedEventId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe WorkflowExecution
externalWorkflowExecution
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
input
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
signalName