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

-- | Contains details about an iteration of a Map state.
--
-- /See:/ 'newMapIterationEventDetails' smart constructor.
data MapIterationEventDetails = MapIterationEventDetails'
  { -- | The index of the array belonging to the Map state iteration.
    MapIterationEventDetails -> Maybe Natural
index :: Prelude.Maybe Prelude.Natural,
    -- | The name of the iteration’s parent Map state.
    MapIterationEventDetails -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (MapIterationEventDetails -> MapIterationEventDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MapIterationEventDetails -> MapIterationEventDetails -> Bool
$c/= :: MapIterationEventDetails -> MapIterationEventDetails -> Bool
== :: MapIterationEventDetails -> MapIterationEventDetails -> Bool
$c== :: MapIterationEventDetails -> MapIterationEventDetails -> Bool
Prelude.Eq, ReadPrec [MapIterationEventDetails]
ReadPrec MapIterationEventDetails
Int -> ReadS MapIterationEventDetails
ReadS [MapIterationEventDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MapIterationEventDetails]
$creadListPrec :: ReadPrec [MapIterationEventDetails]
readPrec :: ReadPrec MapIterationEventDetails
$creadPrec :: ReadPrec MapIterationEventDetails
readList :: ReadS [MapIterationEventDetails]
$creadList :: ReadS [MapIterationEventDetails]
readsPrec :: Int -> ReadS MapIterationEventDetails
$creadsPrec :: Int -> ReadS MapIterationEventDetails
Prelude.Read, Int -> MapIterationEventDetails -> ShowS
[MapIterationEventDetails] -> ShowS
MapIterationEventDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MapIterationEventDetails] -> ShowS
$cshowList :: [MapIterationEventDetails] -> ShowS
show :: MapIterationEventDetails -> String
$cshow :: MapIterationEventDetails -> String
showsPrec :: Int -> MapIterationEventDetails -> ShowS
$cshowsPrec :: Int -> MapIterationEventDetails -> ShowS
Prelude.Show, forall x.
Rep MapIterationEventDetails x -> MapIterationEventDetails
forall x.
MapIterationEventDetails -> Rep MapIterationEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MapIterationEventDetails x -> MapIterationEventDetails
$cfrom :: forall x.
MapIterationEventDetails -> Rep MapIterationEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'MapIterationEventDetails' 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:
--
-- 'index', 'mapIterationEventDetails_index' - The index of the array belonging to the Map state iteration.
--
-- 'name', 'mapIterationEventDetails_name' - The name of the iteration’s parent Map state.
newMapIterationEventDetails ::
  MapIterationEventDetails
newMapIterationEventDetails :: MapIterationEventDetails
newMapIterationEventDetails =
  MapIterationEventDetails'
    { $sel:index:MapIterationEventDetails' :: Maybe Natural
index = forall a. Maybe a
Prelude.Nothing,
      $sel:name:MapIterationEventDetails' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The index of the array belonging to the Map state iteration.
mapIterationEventDetails_index :: Lens.Lens' MapIterationEventDetails (Prelude.Maybe Prelude.Natural)
mapIterationEventDetails_index :: Lens' MapIterationEventDetails (Maybe Natural)
mapIterationEventDetails_index = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MapIterationEventDetails' {Maybe Natural
index :: Maybe Natural
$sel:index:MapIterationEventDetails' :: MapIterationEventDetails -> Maybe Natural
index} -> Maybe Natural
index) (\s :: MapIterationEventDetails
s@MapIterationEventDetails' {} Maybe Natural
a -> MapIterationEventDetails
s {$sel:index:MapIterationEventDetails' :: Maybe Natural
index = Maybe Natural
a} :: MapIterationEventDetails)

-- | The name of the iteration’s parent Map state.
mapIterationEventDetails_name :: Lens.Lens' MapIterationEventDetails (Prelude.Maybe Prelude.Text)
mapIterationEventDetails_name :: Lens' MapIterationEventDetails (Maybe Text)
mapIterationEventDetails_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MapIterationEventDetails' {Maybe Text
name :: Maybe Text
$sel:name:MapIterationEventDetails' :: MapIterationEventDetails -> Maybe Text
name} -> Maybe Text
name) (\s :: MapIterationEventDetails
s@MapIterationEventDetails' {} Maybe Text
a -> MapIterationEventDetails
s {$sel:name:MapIterationEventDetails' :: Maybe Text
name = Maybe Text
a} :: MapIterationEventDetails)

instance Data.FromJSON MapIterationEventDetails where
  parseJSON :: Value -> Parser MapIterationEventDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MapIterationEventDetails"
      ( \Object
x ->
          Maybe Natural -> Maybe Text -> MapIterationEventDetails
MapIterationEventDetails'
            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
"index")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
      )

instance Prelude.Hashable MapIterationEventDetails where
  hashWithSalt :: Int -> MapIterationEventDetails -> Int
hashWithSalt Int
_salt MapIterationEventDetails' {Maybe Natural
Maybe Text
name :: Maybe Text
index :: Maybe Natural
$sel:name:MapIterationEventDetails' :: MapIterationEventDetails -> Maybe Text
$sel:index:MapIterationEventDetails' :: MapIterationEventDetails -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
index
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData MapIterationEventDetails where
  rnf :: MapIterationEventDetails -> ()
rnf MapIterationEventDetails' {Maybe Natural
Maybe Text
name :: Maybe Text
index :: Maybe Natural
$sel:name:MapIterationEventDetails' :: MapIterationEventDetails -> Maybe Text
$sel:index:MapIterationEventDetails' :: MapIterationEventDetails -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
index seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name