{-# 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.StepFunctions.Types.ActivityStartedEventDetails
-- 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.StepFunctions.Types.ActivityStartedEventDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains details about the start of an activity during an execution.
--
-- /See:/ 'newActivityStartedEventDetails' smart constructor.
data ActivityStartedEventDetails = ActivityStartedEventDetails'
  { -- | The name of the worker that the task is assigned to. These names are
    -- provided by the workers when calling GetActivityTask.
    ActivityStartedEventDetails -> Maybe Text
workerName :: Prelude.Maybe Prelude.Text
  }
  deriving (ActivityStartedEventDetails -> ActivityStartedEventDetails -> Bool
(ActivityStartedEventDetails
 -> ActivityStartedEventDetails -> Bool)
-> (ActivityStartedEventDetails
    -> ActivityStartedEventDetails -> Bool)
-> Eq ActivityStartedEventDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActivityStartedEventDetails -> ActivityStartedEventDetails -> Bool
$c/= :: ActivityStartedEventDetails -> ActivityStartedEventDetails -> Bool
== :: ActivityStartedEventDetails -> ActivityStartedEventDetails -> Bool
$c== :: ActivityStartedEventDetails -> ActivityStartedEventDetails -> Bool
Prelude.Eq, ReadPrec [ActivityStartedEventDetails]
ReadPrec ActivityStartedEventDetails
Int -> ReadS ActivityStartedEventDetails
ReadS [ActivityStartedEventDetails]
(Int -> ReadS ActivityStartedEventDetails)
-> ReadS [ActivityStartedEventDetails]
-> ReadPrec ActivityStartedEventDetails
-> ReadPrec [ActivityStartedEventDetails]
-> Read ActivityStartedEventDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActivityStartedEventDetails]
$creadListPrec :: ReadPrec [ActivityStartedEventDetails]
readPrec :: ReadPrec ActivityStartedEventDetails
$creadPrec :: ReadPrec ActivityStartedEventDetails
readList :: ReadS [ActivityStartedEventDetails]
$creadList :: ReadS [ActivityStartedEventDetails]
readsPrec :: Int -> ReadS ActivityStartedEventDetails
$creadsPrec :: Int -> ReadS ActivityStartedEventDetails
Prelude.Read, Int -> ActivityStartedEventDetails -> ShowS
[ActivityStartedEventDetails] -> ShowS
ActivityStartedEventDetails -> String
(Int -> ActivityStartedEventDetails -> ShowS)
-> (ActivityStartedEventDetails -> String)
-> ([ActivityStartedEventDetails] -> ShowS)
-> Show ActivityStartedEventDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActivityStartedEventDetails] -> ShowS
$cshowList :: [ActivityStartedEventDetails] -> ShowS
show :: ActivityStartedEventDetails -> String
$cshow :: ActivityStartedEventDetails -> String
showsPrec :: Int -> ActivityStartedEventDetails -> ShowS
$cshowsPrec :: Int -> ActivityStartedEventDetails -> ShowS
Prelude.Show, (forall x.
 ActivityStartedEventDetails -> Rep ActivityStartedEventDetails x)
-> (forall x.
    Rep ActivityStartedEventDetails x -> ActivityStartedEventDetails)
-> Generic ActivityStartedEventDetails
forall x.
Rep ActivityStartedEventDetails x -> ActivityStartedEventDetails
forall x.
ActivityStartedEventDetails -> Rep ActivityStartedEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ActivityStartedEventDetails x -> ActivityStartedEventDetails
$cfrom :: forall x.
ActivityStartedEventDetails -> Rep ActivityStartedEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'ActivityStartedEventDetails' 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:
--
-- 'workerName', 'activityStartedEventDetails_workerName' - The name of the worker that the task is assigned to. These names are
-- provided by the workers when calling GetActivityTask.
newActivityStartedEventDetails ::
  ActivityStartedEventDetails
newActivityStartedEventDetails :: ActivityStartedEventDetails
newActivityStartedEventDetails =
  ActivityStartedEventDetails' :: Maybe Text -> ActivityStartedEventDetails
ActivityStartedEventDetails'
    { $sel:workerName:ActivityStartedEventDetails' :: Maybe Text
workerName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the worker that the task is assigned to. These names are
-- provided by the workers when calling GetActivityTask.
activityStartedEventDetails_workerName :: Lens.Lens' ActivityStartedEventDetails (Prelude.Maybe Prelude.Text)
activityStartedEventDetails_workerName :: (Maybe Text -> f (Maybe Text))
-> ActivityStartedEventDetails -> f ActivityStartedEventDetails
activityStartedEventDetails_workerName = (ActivityStartedEventDetails -> Maybe Text)
-> (ActivityStartedEventDetails
    -> Maybe Text -> ActivityStartedEventDetails)
-> Lens
     ActivityStartedEventDetails
     ActivityStartedEventDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityStartedEventDetails' {Maybe Text
workerName :: Maybe Text
$sel:workerName:ActivityStartedEventDetails' :: ActivityStartedEventDetails -> Maybe Text
workerName} -> Maybe Text
workerName) (\s :: ActivityStartedEventDetails
s@ActivityStartedEventDetails' {} Maybe Text
a -> ActivityStartedEventDetails
s {$sel:workerName:ActivityStartedEventDetails' :: Maybe Text
workerName = Maybe Text
a} :: ActivityStartedEventDetails)

instance Core.FromJSON ActivityStartedEventDetails where
  parseJSON :: Value -> Parser ActivityStartedEventDetails
parseJSON =
    String
-> (Object -> Parser ActivityStartedEventDetails)
-> Value
-> Parser ActivityStartedEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActivityStartedEventDetails"
      ( \Object
x ->
          Maybe Text -> ActivityStartedEventDetails
ActivityStartedEventDetails'
            (Maybe Text -> ActivityStartedEventDetails)
-> Parser (Maybe Text) -> Parser ActivityStartedEventDetails
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
"workerName")
      )

instance Prelude.Hashable ActivityStartedEventDetails

instance Prelude.NFData ActivityStartedEventDetails