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

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

-- | Provides the details of the @MarkerRecorded@ event.
--
-- /See:/ 'newMarkerRecordedEventAttributes' smart constructor.
data MarkerRecordedEventAttributes = MarkerRecordedEventAttributes'
  { -- | The details of the marker.
    MarkerRecordedEventAttributes -> Maybe Text
details :: Prelude.Maybe Prelude.Text,
    -- | The name of the marker.
    MarkerRecordedEventAttributes -> Text
markerName :: Prelude.Text,
    -- | The ID of the @DecisionTaskCompleted@ event corresponding to the
    -- decision task that resulted in the @RecordMarker@ decision that
    -- requested this marker. This information can be useful for diagnosing
    -- problems by tracing back the chain of events leading up to this event.
    MarkerRecordedEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (MarkerRecordedEventAttributes
-> MarkerRecordedEventAttributes -> Bool
(MarkerRecordedEventAttributes
 -> MarkerRecordedEventAttributes -> Bool)
-> (MarkerRecordedEventAttributes
    -> MarkerRecordedEventAttributes -> Bool)
-> Eq MarkerRecordedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MarkerRecordedEventAttributes
-> MarkerRecordedEventAttributes -> Bool
$c/= :: MarkerRecordedEventAttributes
-> MarkerRecordedEventAttributes -> Bool
== :: MarkerRecordedEventAttributes
-> MarkerRecordedEventAttributes -> Bool
$c== :: MarkerRecordedEventAttributes
-> MarkerRecordedEventAttributes -> Bool
Prelude.Eq, ReadPrec [MarkerRecordedEventAttributes]
ReadPrec MarkerRecordedEventAttributes
Int -> ReadS MarkerRecordedEventAttributes
ReadS [MarkerRecordedEventAttributes]
(Int -> ReadS MarkerRecordedEventAttributes)
-> ReadS [MarkerRecordedEventAttributes]
-> ReadPrec MarkerRecordedEventAttributes
-> ReadPrec [MarkerRecordedEventAttributes]
-> Read MarkerRecordedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MarkerRecordedEventAttributes]
$creadListPrec :: ReadPrec [MarkerRecordedEventAttributes]
readPrec :: ReadPrec MarkerRecordedEventAttributes
$creadPrec :: ReadPrec MarkerRecordedEventAttributes
readList :: ReadS [MarkerRecordedEventAttributes]
$creadList :: ReadS [MarkerRecordedEventAttributes]
readsPrec :: Int -> ReadS MarkerRecordedEventAttributes
$creadsPrec :: Int -> ReadS MarkerRecordedEventAttributes
Prelude.Read, Int -> MarkerRecordedEventAttributes -> ShowS
[MarkerRecordedEventAttributes] -> ShowS
MarkerRecordedEventAttributes -> String
(Int -> MarkerRecordedEventAttributes -> ShowS)
-> (MarkerRecordedEventAttributes -> String)
-> ([MarkerRecordedEventAttributes] -> ShowS)
-> Show MarkerRecordedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MarkerRecordedEventAttributes] -> ShowS
$cshowList :: [MarkerRecordedEventAttributes] -> ShowS
show :: MarkerRecordedEventAttributes -> String
$cshow :: MarkerRecordedEventAttributes -> String
showsPrec :: Int -> MarkerRecordedEventAttributes -> ShowS
$cshowsPrec :: Int -> MarkerRecordedEventAttributes -> ShowS
Prelude.Show, (forall x.
 MarkerRecordedEventAttributes
 -> Rep MarkerRecordedEventAttributes x)
-> (forall x.
    Rep MarkerRecordedEventAttributes x
    -> MarkerRecordedEventAttributes)
-> Generic MarkerRecordedEventAttributes
forall x.
Rep MarkerRecordedEventAttributes x
-> MarkerRecordedEventAttributes
forall x.
MarkerRecordedEventAttributes
-> Rep MarkerRecordedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MarkerRecordedEventAttributes x
-> MarkerRecordedEventAttributes
$cfrom :: forall x.
MarkerRecordedEventAttributes
-> Rep MarkerRecordedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'MarkerRecordedEventAttributes' 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:
--
-- 'details', 'markerRecordedEventAttributes_details' - The details of the marker.
--
-- 'markerName', 'markerRecordedEventAttributes_markerName' - The name of the marker.
--
-- 'decisionTaskCompletedEventId', 'markerRecordedEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @RecordMarker@ decision that
-- requested this marker. This information can be useful for diagnosing
-- problems by tracing back the chain of events leading up to this event.
newMarkerRecordedEventAttributes ::
  -- | 'markerName'
  Prelude.Text ->
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  MarkerRecordedEventAttributes
newMarkerRecordedEventAttributes :: Text -> Integer -> MarkerRecordedEventAttributes
newMarkerRecordedEventAttributes
  Text
pMarkerName_
  Integer
pDecisionTaskCompletedEventId_ =
    MarkerRecordedEventAttributes' :: Maybe Text -> Text -> Integer -> MarkerRecordedEventAttributes
MarkerRecordedEventAttributes'
      { $sel:details:MarkerRecordedEventAttributes' :: Maybe Text
details =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:markerName:MarkerRecordedEventAttributes' :: Text
markerName = Text
pMarkerName_,
        $sel:decisionTaskCompletedEventId:MarkerRecordedEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

-- | The details of the marker.
markerRecordedEventAttributes_details :: Lens.Lens' MarkerRecordedEventAttributes (Prelude.Maybe Prelude.Text)
markerRecordedEventAttributes_details :: (Maybe Text -> f (Maybe Text))
-> MarkerRecordedEventAttributes -> f MarkerRecordedEventAttributes
markerRecordedEventAttributes_details = (MarkerRecordedEventAttributes -> Maybe Text)
-> (MarkerRecordedEventAttributes
    -> Maybe Text -> MarkerRecordedEventAttributes)
-> Lens
     MarkerRecordedEventAttributes
     MarkerRecordedEventAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MarkerRecordedEventAttributes' {Maybe Text
details :: Maybe Text
$sel:details:MarkerRecordedEventAttributes' :: MarkerRecordedEventAttributes -> Maybe Text
details} -> Maybe Text
details) (\s :: MarkerRecordedEventAttributes
s@MarkerRecordedEventAttributes' {} Maybe Text
a -> MarkerRecordedEventAttributes
s {$sel:details:MarkerRecordedEventAttributes' :: Maybe Text
details = Maybe Text
a} :: MarkerRecordedEventAttributes)

-- | The name of the marker.
markerRecordedEventAttributes_markerName :: Lens.Lens' MarkerRecordedEventAttributes Prelude.Text
markerRecordedEventAttributes_markerName :: (Text -> f Text)
-> MarkerRecordedEventAttributes -> f MarkerRecordedEventAttributes
markerRecordedEventAttributes_markerName = (MarkerRecordedEventAttributes -> Text)
-> (MarkerRecordedEventAttributes
    -> Text -> MarkerRecordedEventAttributes)
-> Lens
     MarkerRecordedEventAttributes
     MarkerRecordedEventAttributes
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MarkerRecordedEventAttributes' {Text
markerName :: Text
$sel:markerName:MarkerRecordedEventAttributes' :: MarkerRecordedEventAttributes -> Text
markerName} -> Text
markerName) (\s :: MarkerRecordedEventAttributes
s@MarkerRecordedEventAttributes' {} Text
a -> MarkerRecordedEventAttributes
s {$sel:markerName:MarkerRecordedEventAttributes' :: Text
markerName = Text
a} :: MarkerRecordedEventAttributes)

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @RecordMarker@ decision that
-- requested this marker. This information can be useful for diagnosing
-- problems by tracing back the chain of events leading up to this event.
markerRecordedEventAttributes_decisionTaskCompletedEventId :: Lens.Lens' MarkerRecordedEventAttributes Prelude.Integer
markerRecordedEventAttributes_decisionTaskCompletedEventId :: (Integer -> f Integer)
-> MarkerRecordedEventAttributes -> f MarkerRecordedEventAttributes
markerRecordedEventAttributes_decisionTaskCompletedEventId = (MarkerRecordedEventAttributes -> Integer)
-> (MarkerRecordedEventAttributes
    -> Integer -> MarkerRecordedEventAttributes)
-> Lens
     MarkerRecordedEventAttributes
     MarkerRecordedEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MarkerRecordedEventAttributes' {Integer
decisionTaskCompletedEventId :: Integer
$sel:decisionTaskCompletedEventId:MarkerRecordedEventAttributes' :: MarkerRecordedEventAttributes -> Integer
decisionTaskCompletedEventId} -> Integer
decisionTaskCompletedEventId) (\s :: MarkerRecordedEventAttributes
s@MarkerRecordedEventAttributes' {} Integer
a -> MarkerRecordedEventAttributes
s {$sel:decisionTaskCompletedEventId:MarkerRecordedEventAttributes' :: Integer
decisionTaskCompletedEventId = Integer
a} :: MarkerRecordedEventAttributes)

instance Core.FromJSON MarkerRecordedEventAttributes where
  parseJSON :: Value -> Parser MarkerRecordedEventAttributes
parseJSON =
    String
-> (Object -> Parser MarkerRecordedEventAttributes)
-> Value
-> Parser MarkerRecordedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MarkerRecordedEventAttributes"
      ( \Object
x ->
          Maybe Text -> Text -> Integer -> MarkerRecordedEventAttributes
MarkerRecordedEventAttributes'
            (Maybe Text -> Text -> Integer -> MarkerRecordedEventAttributes)
-> Parser (Maybe Text)
-> Parser (Text -> Integer -> MarkerRecordedEventAttributes)
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
"details")
            Parser (Text -> Integer -> MarkerRecordedEventAttributes)
-> Parser Text -> Parser (Integer -> MarkerRecordedEventAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"markerName")
            Parser (Integer -> MarkerRecordedEventAttributes)
-> Parser Integer -> Parser MarkerRecordedEventAttributes
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
"decisionTaskCompletedEventId")
      )

instance
  Prelude.Hashable
    MarkerRecordedEventAttributes

instance Prelude.NFData MarkerRecordedEventAttributes