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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.StepFunctions.Types.HistoryEventExecutionDataDetails

-- | Contains details about a state entered during an execution.
--
-- /See:/ 'newStateEnteredEventDetails' smart constructor.
data StateEnteredEventDetails = StateEnteredEventDetails'
  { -- | Contains details about the input for an execution history event.
    StateEnteredEventDetails -> Maybe HistoryEventExecutionDataDetails
inputDetails :: Prelude.Maybe HistoryEventExecutionDataDetails,
    -- | The string that contains the JSON input data for the state. Length
    -- constraints apply to the payload size, and are expressed as bytes in
    -- UTF-8 encoding.
    StateEnteredEventDetails -> Maybe (Sensitive Text)
input :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The name of the state.
    StateEnteredEventDetails -> Text
name :: Prelude.Text
  }
  deriving (StateEnteredEventDetails -> StateEnteredEventDetails -> Bool
(StateEnteredEventDetails -> StateEnteredEventDetails -> Bool)
-> (StateEnteredEventDetails -> StateEnteredEventDetails -> Bool)
-> Eq StateEnteredEventDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StateEnteredEventDetails -> StateEnteredEventDetails -> Bool
$c/= :: StateEnteredEventDetails -> StateEnteredEventDetails -> Bool
== :: StateEnteredEventDetails -> StateEnteredEventDetails -> Bool
$c== :: StateEnteredEventDetails -> StateEnteredEventDetails -> Bool
Prelude.Eq, Int -> StateEnteredEventDetails -> ShowS
[StateEnteredEventDetails] -> ShowS
StateEnteredEventDetails -> String
(Int -> StateEnteredEventDetails -> ShowS)
-> (StateEnteredEventDetails -> String)
-> ([StateEnteredEventDetails] -> ShowS)
-> Show StateEnteredEventDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StateEnteredEventDetails] -> ShowS
$cshowList :: [StateEnteredEventDetails] -> ShowS
show :: StateEnteredEventDetails -> String
$cshow :: StateEnteredEventDetails -> String
showsPrec :: Int -> StateEnteredEventDetails -> ShowS
$cshowsPrec :: Int -> StateEnteredEventDetails -> ShowS
Prelude.Show, (forall x.
 StateEnteredEventDetails -> Rep StateEnteredEventDetails x)
-> (forall x.
    Rep StateEnteredEventDetails x -> StateEnteredEventDetails)
-> Generic StateEnteredEventDetails
forall x.
Rep StateEnteredEventDetails x -> StateEnteredEventDetails
forall x.
StateEnteredEventDetails -> Rep StateEnteredEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StateEnteredEventDetails x -> StateEnteredEventDetails
$cfrom :: forall x.
StateEnteredEventDetails -> Rep StateEnteredEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'StateEnteredEventDetails' 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:
--
-- 'inputDetails', 'stateEnteredEventDetails_inputDetails' - Contains details about the input for an execution history event.
--
-- 'input', 'stateEnteredEventDetails_input' - The string that contains the JSON input data for the state. Length
-- constraints apply to the payload size, and are expressed as bytes in
-- UTF-8 encoding.
--
-- 'name', 'stateEnteredEventDetails_name' - The name of the state.
newStateEnteredEventDetails ::
  -- | 'name'
  Prelude.Text ->
  StateEnteredEventDetails
newStateEnteredEventDetails :: Text -> StateEnteredEventDetails
newStateEnteredEventDetails Text
pName_ =
  StateEnteredEventDetails' :: Maybe HistoryEventExecutionDataDetails
-> Maybe (Sensitive Text) -> Text -> StateEnteredEventDetails
StateEnteredEventDetails'
    { $sel:inputDetails:StateEnteredEventDetails' :: Maybe HistoryEventExecutionDataDetails
inputDetails =
        Maybe HistoryEventExecutionDataDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:input:StateEnteredEventDetails' :: Maybe (Sensitive Text)
input = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:StateEnteredEventDetails' :: Text
name = Text
pName_
    }

-- | Contains details about the input for an execution history event.
stateEnteredEventDetails_inputDetails :: Lens.Lens' StateEnteredEventDetails (Prelude.Maybe HistoryEventExecutionDataDetails)
stateEnteredEventDetails_inputDetails :: (Maybe HistoryEventExecutionDataDetails
 -> f (Maybe HistoryEventExecutionDataDetails))
-> StateEnteredEventDetails -> f StateEnteredEventDetails
stateEnteredEventDetails_inputDetails = (StateEnteredEventDetails
 -> Maybe HistoryEventExecutionDataDetails)
-> (StateEnteredEventDetails
    -> Maybe HistoryEventExecutionDataDetails
    -> StateEnteredEventDetails)
-> Lens
     StateEnteredEventDetails
     StateEnteredEventDetails
     (Maybe HistoryEventExecutionDataDetails)
     (Maybe HistoryEventExecutionDataDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StateEnteredEventDetails' {Maybe HistoryEventExecutionDataDetails
inputDetails :: Maybe HistoryEventExecutionDataDetails
$sel:inputDetails:StateEnteredEventDetails' :: StateEnteredEventDetails -> Maybe HistoryEventExecutionDataDetails
inputDetails} -> Maybe HistoryEventExecutionDataDetails
inputDetails) (\s :: StateEnteredEventDetails
s@StateEnteredEventDetails' {} Maybe HistoryEventExecutionDataDetails
a -> StateEnteredEventDetails
s {$sel:inputDetails:StateEnteredEventDetails' :: Maybe HistoryEventExecutionDataDetails
inputDetails = Maybe HistoryEventExecutionDataDetails
a} :: StateEnteredEventDetails)

-- | The string that contains the JSON input data for the state. Length
-- constraints apply to the payload size, and are expressed as bytes in
-- UTF-8 encoding.
stateEnteredEventDetails_input :: Lens.Lens' StateEnteredEventDetails (Prelude.Maybe Prelude.Text)
stateEnteredEventDetails_input :: (Maybe Text -> f (Maybe Text))
-> StateEnteredEventDetails -> f StateEnteredEventDetails
stateEnteredEventDetails_input = (StateEnteredEventDetails -> Maybe (Sensitive Text))
-> (StateEnteredEventDetails
    -> Maybe (Sensitive Text) -> StateEnteredEventDetails)
-> Lens
     StateEnteredEventDetails
     StateEnteredEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StateEnteredEventDetails' {Maybe (Sensitive Text)
input :: Maybe (Sensitive Text)
$sel:input:StateEnteredEventDetails' :: StateEnteredEventDetails -> Maybe (Sensitive Text)
input} -> Maybe (Sensitive Text)
input) (\s :: StateEnteredEventDetails
s@StateEnteredEventDetails' {} Maybe (Sensitive Text)
a -> StateEnteredEventDetails
s {$sel:input:StateEnteredEventDetails' :: Maybe (Sensitive Text)
input = Maybe (Sensitive Text)
a} :: StateEnteredEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> StateEnteredEventDetails -> f StateEnteredEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> StateEnteredEventDetails
-> f StateEnteredEventDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

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

instance Core.FromJSON StateEnteredEventDetails where
  parseJSON :: Value -> Parser StateEnteredEventDetails
parseJSON =
    String
-> (Object -> Parser StateEnteredEventDetails)
-> Value
-> Parser StateEnteredEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StateEnteredEventDetails"
      ( \Object
x ->
          Maybe HistoryEventExecutionDataDetails
-> Maybe (Sensitive Text) -> Text -> StateEnteredEventDetails
StateEnteredEventDetails'
            (Maybe HistoryEventExecutionDataDetails
 -> Maybe (Sensitive Text) -> Text -> StateEnteredEventDetails)
-> Parser (Maybe HistoryEventExecutionDataDetails)
-> Parser
     (Maybe (Sensitive Text) -> Text -> StateEnteredEventDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe HistoryEventExecutionDataDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputDetails")
            Parser (Maybe (Sensitive Text) -> Text -> StateEnteredEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser (Text -> StateEnteredEventDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"input")
            Parser (Text -> StateEnteredEventDetails)
-> Parser Text -> Parser StateEnteredEventDetails
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
"name")
      )

instance Prelude.Hashable StateEnteredEventDetails

instance Prelude.NFData StateEnteredEventDetails