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

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

instance
  Prelude.Hashable
    DecisionTaskStartedEventAttributes

instance
  Prelude.NFData
    DecisionTaskStartedEventAttributes