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

-- |
-- Create a value of 'ActivityTaskStartedEventAttributes' 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', 'activityTaskStartedEventAttributes_identity' - Identity of the worker that was assigned this task. This aids
-- diagnostics when problems arise. The form of this identity is user
-- defined.
--
-- 'scheduledEventId', 'activityTaskStartedEventAttributes_scheduledEventId' - The ID of the @ActivityTaskScheduled@ event that was recorded when this
-- activity task was scheduled. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
newActivityTaskStartedEventAttributes ::
  -- | 'scheduledEventId'
  Prelude.Integer ->
  ActivityTaskStartedEventAttributes
newActivityTaskStartedEventAttributes :: Integer -> ActivityTaskStartedEventAttributes
newActivityTaskStartedEventAttributes
  Integer
pScheduledEventId_ =
    ActivityTaskStartedEventAttributes'
      { $sel:identity:ActivityTaskStartedEventAttributes' :: Maybe Text
identity =
          forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledEventId:ActivityTaskStartedEventAttributes' :: Integer
scheduledEventId = Integer
pScheduledEventId_
      }

-- | Identity of the worker that was assigned this task. This aids
-- diagnostics when problems arise. The form of this identity is user
-- defined.
activityTaskStartedEventAttributes_identity :: Lens.Lens' ActivityTaskStartedEventAttributes (Prelude.Maybe Prelude.Text)
activityTaskStartedEventAttributes_identity :: Lens' ActivityTaskStartedEventAttributes (Maybe Text)
activityTaskStartedEventAttributes_identity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTaskStartedEventAttributes' {Maybe Text
identity :: Maybe Text
$sel:identity:ActivityTaskStartedEventAttributes' :: ActivityTaskStartedEventAttributes -> Maybe Text
identity} -> Maybe Text
identity) (\s :: ActivityTaskStartedEventAttributes
s@ActivityTaskStartedEventAttributes' {} Maybe Text
a -> ActivityTaskStartedEventAttributes
s {$sel:identity:ActivityTaskStartedEventAttributes' :: Maybe Text
identity = Maybe Text
a} :: ActivityTaskStartedEventAttributes)

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

instance
  Data.FromJSON
    ActivityTaskStartedEventAttributes
  where
  parseJSON :: Value -> Parser ActivityTaskStartedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActivityTaskStartedEventAttributes"
      ( \Object
x ->
          Maybe Text -> Integer -> ActivityTaskStartedEventAttributes
ActivityTaskStartedEventAttributes'
            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
    ActivityTaskStartedEventAttributes
  where
  hashWithSalt :: Int -> ActivityTaskStartedEventAttributes -> Int
hashWithSalt
    Int
_salt
    ActivityTaskStartedEventAttributes' {Integer
Maybe Text
scheduledEventId :: Integer
identity :: Maybe Text
$sel:scheduledEventId:ActivityTaskStartedEventAttributes' :: ActivityTaskStartedEventAttributes -> Integer
$sel:identity:ActivityTaskStartedEventAttributes' :: ActivityTaskStartedEventAttributes -> 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
    ActivityTaskStartedEventAttributes
  where
  rnf :: ActivityTaskStartedEventAttributes -> ()
rnf ActivityTaskStartedEventAttributes' {Integer
Maybe Text
scheduledEventId :: Integer
identity :: Maybe Text
$sel:scheduledEventId:ActivityTaskStartedEventAttributes' :: ActivityTaskStartedEventAttributes -> Integer
$sel:identity:ActivityTaskStartedEventAttributes' :: ActivityTaskStartedEventAttributes -> 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