{-# 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.DecisionTaskStartedEventAttributes
-- 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.DecisionTaskStartedEventAttributes 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 @DecisionTaskStarted@ event.
--
-- /See:/ 'newDecisionTaskStartedEventAttributes' smart constructor.
data DecisionTaskStartedEventAttributes = DecisionTaskStartedEventAttributes'
  { -- | Identity of the decider making the request. This enables diagnostic
    -- tracing when problems arise. The form of this identity is user defined.
    DecisionTaskStartedEventAttributes -> Maybe Text
identity :: Prelude.Maybe Prelude.Text,
    -- | The ID of the @DecisionTaskScheduled@ event that was recorded when this
    -- decision task was scheduled. This information can be useful for
    -- diagnosing problems by tracing back the chain of events leading up to
    -- this event.
    DecisionTaskStartedEventAttributes -> Integer
scheduledEventId :: Prelude.Integer
  }
  deriving (DecisionTaskStartedEventAttributes
-> DecisionTaskStartedEventAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecisionTaskStartedEventAttributes
-> DecisionTaskStartedEventAttributes -> Bool
$c/= :: DecisionTaskStartedEventAttributes
-> DecisionTaskStartedEventAttributes -> Bool
== :: DecisionTaskStartedEventAttributes
-> DecisionTaskStartedEventAttributes -> Bool
$c== :: DecisionTaskStartedEventAttributes
-> DecisionTaskStartedEventAttributes -> Bool
Prelude.Eq, ReadPrec [DecisionTaskStartedEventAttributes]
ReadPrec DecisionTaskStartedEventAttributes
Int -> ReadS DecisionTaskStartedEventAttributes
ReadS [DecisionTaskStartedEventAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DecisionTaskStartedEventAttributes]
$creadListPrec :: ReadPrec [DecisionTaskStartedEventAttributes]
readPrec :: ReadPrec DecisionTaskStartedEventAttributes
$creadPrec :: ReadPrec DecisionTaskStartedEventAttributes
readList :: ReadS [DecisionTaskStartedEventAttributes]
$creadList :: ReadS [DecisionTaskStartedEventAttributes]
readsPrec :: Int -> ReadS DecisionTaskStartedEventAttributes
$creadsPrec :: Int -> ReadS DecisionTaskStartedEventAttributes
Prelude.Read, Int -> DecisionTaskStartedEventAttributes -> ShowS
[DecisionTaskStartedEventAttributes] -> ShowS
DecisionTaskStartedEventAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecisionTaskStartedEventAttributes] -> ShowS
$cshowList :: [DecisionTaskStartedEventAttributes] -> ShowS
show :: DecisionTaskStartedEventAttributes -> String
$cshow :: DecisionTaskStartedEventAttributes -> String
showsPrec :: Int -> DecisionTaskStartedEventAttributes -> ShowS
$cshowsPrec :: Int -> DecisionTaskStartedEventAttributes -> ShowS
Prelude.Show, forall x.
Rep DecisionTaskStartedEventAttributes x
-> DecisionTaskStartedEventAttributes
forall x.
DecisionTaskStartedEventAttributes
-> Rep DecisionTaskStartedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DecisionTaskStartedEventAttributes x
-> DecisionTaskStartedEventAttributes
$cfrom :: forall x.
DecisionTaskStartedEventAttributes
-> Rep DecisionTaskStartedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'DecisionTaskStartedEventAttributes' 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:
--
-- 'identity', 'decisionTaskStartedEventAttributes_identity' - Identity of the decider making the request. This enables diagnostic
-- tracing when problems arise. The form of this identity is user defined.
--
-- 'scheduledEventId', 'decisionTaskStartedEventAttributes_scheduledEventId' - The ID of the @DecisionTaskScheduled@ event that was recorded when this
-- decision task was scheduled. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
newDecisionTaskStartedEventAttributes ::
  -- | 'scheduledEventId'
  Prelude.Integer ->
  DecisionTaskStartedEventAttributes
newDecisionTaskStartedEventAttributes :: Integer -> DecisionTaskStartedEventAttributes
newDecisionTaskStartedEventAttributes
  Integer
pScheduledEventId_ =
    DecisionTaskStartedEventAttributes'
      { $sel:identity:DecisionTaskStartedEventAttributes' :: Maybe Text
identity =
          forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledEventId:DecisionTaskStartedEventAttributes' :: Integer
scheduledEventId = Integer
pScheduledEventId_
      }

-- | Identity of the decider making the request. This enables diagnostic
-- tracing when problems arise. The form of this identity is user defined.
decisionTaskStartedEventAttributes_identity :: Lens.Lens' DecisionTaskStartedEventAttributes (Prelude.Maybe Prelude.Text)
decisionTaskStartedEventAttributes_identity :: Lens' DecisionTaskStartedEventAttributes (Maybe Text)
decisionTaskStartedEventAttributes_identity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecisionTaskStartedEventAttributes' {Maybe Text
identity :: Maybe Text
$sel:identity:DecisionTaskStartedEventAttributes' :: DecisionTaskStartedEventAttributes -> Maybe Text
identity} -> Maybe Text
identity) (\s :: DecisionTaskStartedEventAttributes
s@DecisionTaskStartedEventAttributes' {} Maybe Text
a -> DecisionTaskStartedEventAttributes
s {$sel:identity:DecisionTaskStartedEventAttributes' :: Maybe Text
identity = Maybe Text
a} :: DecisionTaskStartedEventAttributes)

-- | The ID of the @DecisionTaskScheduled@ event that was recorded when this
-- decision task was scheduled. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
decisionTaskStartedEventAttributes_scheduledEventId :: Lens.Lens' DecisionTaskStartedEventAttributes Prelude.Integer
decisionTaskStartedEventAttributes_scheduledEventId :: Lens' DecisionTaskStartedEventAttributes Integer
decisionTaskStartedEventAttributes_scheduledEventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecisionTaskStartedEventAttributes' {Integer
scheduledEventId :: Integer
$sel:scheduledEventId:DecisionTaskStartedEventAttributes' :: DecisionTaskStartedEventAttributes -> Integer
scheduledEventId} -> Integer
scheduledEventId) (\s :: DecisionTaskStartedEventAttributes
s@DecisionTaskStartedEventAttributes' {} Integer
a -> DecisionTaskStartedEventAttributes
s {$sel:scheduledEventId:DecisionTaskStartedEventAttributes' :: Integer
scheduledEventId = Integer
a} :: DecisionTaskStartedEventAttributes)

instance
  Data.FromJSON
    DecisionTaskStartedEventAttributes
  where
  parseJSON :: Value -> Parser DecisionTaskStartedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DecisionTaskStartedEventAttributes"
      ( \Object
x ->
          Maybe Text -> Integer -> DecisionTaskStartedEventAttributes
DecisionTaskStartedEventAttributes'
            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
"identity")
            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
"scheduledEventId")
      )

instance
  Prelude.Hashable
    DecisionTaskStartedEventAttributes
  where
  hashWithSalt :: Int -> DecisionTaskStartedEventAttributes -> Int
hashWithSalt
    Int
_salt
    DecisionTaskStartedEventAttributes' {Integer
Maybe Text
scheduledEventId :: Integer
identity :: Maybe Text
$sel:scheduledEventId:DecisionTaskStartedEventAttributes' :: DecisionTaskStartedEventAttributes -> Integer
$sel:identity:DecisionTaskStartedEventAttributes' :: DecisionTaskStartedEventAttributes -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identity
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
scheduledEventId

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