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

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

-- | Contains details about an iteration of a Map state.
--
-- /See:/ 'newMapIterationEventDetails' smart constructor.
data MapIterationEventDetails = MapIterationEventDetails'
  { -- | The name of the iteration’s parent Map state.
    MapIterationEventDetails -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The index of the array belonging to the Map state iteration.
    MapIterationEventDetails -> Maybe Natural
index :: Prelude.Maybe Prelude.Natural
  }
  deriving (MapIterationEventDetails -> MapIterationEventDetails -> Bool
(MapIterationEventDetails -> MapIterationEventDetails -> Bool)
-> (MapIterationEventDetails -> MapIterationEventDetails -> Bool)
-> Eq MapIterationEventDetails
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]
(Int -> ReadS MapIterationEventDetails)
-> ReadS [MapIterationEventDetails]
-> ReadPrec MapIterationEventDetails
-> ReadPrec [MapIterationEventDetails]
-> Read 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
(Int -> MapIterationEventDetails -> ShowS)
-> (MapIterationEventDetails -> String)
-> ([MapIterationEventDetails] -> ShowS)
-> Show MapIterationEventDetails
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.
 MapIterationEventDetails -> Rep MapIterationEventDetails x)
-> (forall x.
    Rep MapIterationEventDetails x -> MapIterationEventDetails)
-> Generic MapIterationEventDetails
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:
--
-- 'name', 'mapIterationEventDetails_name' - The name of the iteration’s parent Map state.
--
-- 'index', 'mapIterationEventDetails_index' - The index of the array belonging to the Map state iteration.
newMapIterationEventDetails ::
  MapIterationEventDetails
newMapIterationEventDetails :: MapIterationEventDetails
newMapIterationEventDetails =
  MapIterationEventDetails' :: Maybe Text -> Maybe Natural -> MapIterationEventDetails
MapIterationEventDetails'
    { $sel:name:MapIterationEventDetails' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:index:MapIterationEventDetails' :: Maybe Natural
index = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the iteration’s parent Map state.
mapIterationEventDetails_name :: Lens.Lens' MapIterationEventDetails (Prelude.Maybe Prelude.Text)
mapIterationEventDetails_name :: (Maybe Text -> f (Maybe Text))
-> MapIterationEventDetails -> f MapIterationEventDetails
mapIterationEventDetails_name = (MapIterationEventDetails -> Maybe Text)
-> (MapIterationEventDetails
    -> Maybe Text -> MapIterationEventDetails)
-> Lens
     MapIterationEventDetails
     MapIterationEventDetails
     (Maybe Text)
     (Maybe Text)
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)

-- | The index of the array belonging to the Map state iteration.
mapIterationEventDetails_index :: Lens.Lens' MapIterationEventDetails (Prelude.Maybe Prelude.Natural)
mapIterationEventDetails_index :: (Maybe Natural -> f (Maybe Natural))
-> MapIterationEventDetails -> f MapIterationEventDetails
mapIterationEventDetails_index = (MapIterationEventDetails -> Maybe Natural)
-> (MapIterationEventDetails
    -> Maybe Natural -> MapIterationEventDetails)
-> Lens
     MapIterationEventDetails
     MapIterationEventDetails
     (Maybe Natural)
     (Maybe Natural)
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)

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

instance Prelude.Hashable MapIterationEventDetails

instance Prelude.NFData MapIterationEventDetails