{-# 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.MigrationHubOrchestrator.Types.StepInput
-- 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.MigrationHubOrchestrator.Types.StepInput 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

-- | A map of key value pairs that is generated when you create a migration
-- workflow. The key value pairs will differ based on your selection of the
-- template.
--
-- /See:/ 'newStepInput' smart constructor.
data StepInput = StepInput'
  { -- | The value of the integer.
    StepInput -> Maybe Int
integerValue :: Prelude.Maybe Prelude.Int,
    -- | List of string values.
    StepInput -> Maybe [Text]
listOfStringsValue :: Prelude.Maybe [Prelude.Text],
    -- | Map of string values.
    StepInput -> Maybe (HashMap Text Text)
mapOfStringValue :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | String value.
    StepInput -> Maybe Text
stringValue :: Prelude.Maybe Prelude.Text
  }
  deriving (StepInput -> StepInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StepInput -> StepInput -> Bool
$c/= :: StepInput -> StepInput -> Bool
== :: StepInput -> StepInput -> Bool
$c== :: StepInput -> StepInput -> Bool
Prelude.Eq, ReadPrec [StepInput]
ReadPrec StepInput
Int -> ReadS StepInput
ReadS [StepInput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StepInput]
$creadListPrec :: ReadPrec [StepInput]
readPrec :: ReadPrec StepInput
$creadPrec :: ReadPrec StepInput
readList :: ReadS [StepInput]
$creadList :: ReadS [StepInput]
readsPrec :: Int -> ReadS StepInput
$creadsPrec :: Int -> ReadS StepInput
Prelude.Read, Int -> StepInput -> ShowS
[StepInput] -> ShowS
StepInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StepInput] -> ShowS
$cshowList :: [StepInput] -> ShowS
show :: StepInput -> String
$cshow :: StepInput -> String
showsPrec :: Int -> StepInput -> ShowS
$cshowsPrec :: Int -> StepInput -> ShowS
Prelude.Show, forall x. Rep StepInput x -> StepInput
forall x. StepInput -> Rep StepInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StepInput x -> StepInput
$cfrom :: forall x. StepInput -> Rep StepInput x
Prelude.Generic)

-- |
-- Create a value of 'StepInput' 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:
--
-- 'integerValue', 'stepInput_integerValue' - The value of the integer.
--
-- 'listOfStringsValue', 'stepInput_listOfStringsValue' - List of string values.
--
-- 'mapOfStringValue', 'stepInput_mapOfStringValue' - Map of string values.
--
-- 'stringValue', 'stepInput_stringValue' - String value.
newStepInput ::
  StepInput
newStepInput :: StepInput
newStepInput =
  StepInput'
    { $sel:integerValue:StepInput' :: Maybe Int
integerValue = forall a. Maybe a
Prelude.Nothing,
      $sel:listOfStringsValue:StepInput' :: Maybe [Text]
listOfStringsValue = forall a. Maybe a
Prelude.Nothing,
      $sel:mapOfStringValue:StepInput' :: Maybe (HashMap Text Text)
mapOfStringValue = forall a. Maybe a
Prelude.Nothing,
      $sel:stringValue:StepInput' :: Maybe Text
stringValue = forall a. Maybe a
Prelude.Nothing
    }

-- | The value of the integer.
stepInput_integerValue :: Lens.Lens' StepInput (Prelude.Maybe Prelude.Int)
stepInput_integerValue :: Lens' StepInput (Maybe Int)
stepInput_integerValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepInput' {Maybe Int
integerValue :: Maybe Int
$sel:integerValue:StepInput' :: StepInput -> Maybe Int
integerValue} -> Maybe Int
integerValue) (\s :: StepInput
s@StepInput' {} Maybe Int
a -> StepInput
s {$sel:integerValue:StepInput' :: Maybe Int
integerValue = Maybe Int
a} :: StepInput)

-- | List of string values.
stepInput_listOfStringsValue :: Lens.Lens' StepInput (Prelude.Maybe [Prelude.Text])
stepInput_listOfStringsValue :: Lens' StepInput (Maybe [Text])
stepInput_listOfStringsValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepInput' {Maybe [Text]
listOfStringsValue :: Maybe [Text]
$sel:listOfStringsValue:StepInput' :: StepInput -> Maybe [Text]
listOfStringsValue} -> Maybe [Text]
listOfStringsValue) (\s :: StepInput
s@StepInput' {} Maybe [Text]
a -> StepInput
s {$sel:listOfStringsValue:StepInput' :: Maybe [Text]
listOfStringsValue = Maybe [Text]
a} :: StepInput) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Map of string values.
stepInput_mapOfStringValue :: Lens.Lens' StepInput (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
stepInput_mapOfStringValue :: Lens' StepInput (Maybe (HashMap Text Text))
stepInput_mapOfStringValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepInput' {Maybe (HashMap Text Text)
mapOfStringValue :: Maybe (HashMap Text Text)
$sel:mapOfStringValue:StepInput' :: StepInput -> Maybe (HashMap Text Text)
mapOfStringValue} -> Maybe (HashMap Text Text)
mapOfStringValue) (\s :: StepInput
s@StepInput' {} Maybe (HashMap Text Text)
a -> StepInput
s {$sel:mapOfStringValue:StepInput' :: Maybe (HashMap Text Text)
mapOfStringValue = Maybe (HashMap Text Text)
a} :: StepInput) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | String value.
stepInput_stringValue :: Lens.Lens' StepInput (Prelude.Maybe Prelude.Text)
stepInput_stringValue :: Lens' StepInput (Maybe Text)
stepInput_stringValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepInput' {Maybe Text
stringValue :: Maybe Text
$sel:stringValue:StepInput' :: StepInput -> Maybe Text
stringValue} -> Maybe Text
stringValue) (\s :: StepInput
s@StepInput' {} Maybe Text
a -> StepInput
s {$sel:stringValue:StepInput' :: Maybe Text
stringValue = Maybe Text
a} :: StepInput)

instance Data.FromJSON StepInput where
  parseJSON :: Value -> Parser StepInput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StepInput"
      ( \Object
x ->
          Maybe Int
-> Maybe [Text]
-> Maybe (HashMap Text Text)
-> Maybe Text
-> StepInput
StepInput'
            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
"integerValue")
            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
"listOfStringsValue"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"mapOfStringValue"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"stringValue")
      )

instance Prelude.Hashable StepInput where
  hashWithSalt :: Int -> StepInput -> Int
hashWithSalt Int
_salt StepInput' {Maybe Int
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
stringValue :: Maybe Text
mapOfStringValue :: Maybe (HashMap Text Text)
listOfStringsValue :: Maybe [Text]
integerValue :: Maybe Int
$sel:stringValue:StepInput' :: StepInput -> Maybe Text
$sel:mapOfStringValue:StepInput' :: StepInput -> Maybe (HashMap Text Text)
$sel:listOfStringsValue:StepInput' :: StepInput -> Maybe [Text]
$sel:integerValue:StepInput' :: StepInput -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
integerValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
listOfStringsValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
mapOfStringValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stringValue

instance Prelude.NFData StepInput where
  rnf :: StepInput -> ()
rnf StepInput' {Maybe Int
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
stringValue :: Maybe Text
mapOfStringValue :: Maybe (HashMap Text Text)
listOfStringsValue :: Maybe [Text]
integerValue :: Maybe Int
$sel:stringValue:StepInput' :: StepInput -> Maybe Text
$sel:mapOfStringValue:StepInput' :: StepInput -> Maybe (HashMap Text Text)
$sel:listOfStringsValue:StepInput' :: StepInput -> Maybe [Text]
$sel:integerValue:StepInput' :: StepInput -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
integerValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
listOfStringsValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
mapOfStringValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stringValue

instance Data.ToJSON StepInput where
  toJSON :: StepInput -> Value
toJSON StepInput' {Maybe Int
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
stringValue :: Maybe Text
mapOfStringValue :: Maybe (HashMap Text Text)
listOfStringsValue :: Maybe [Text]
integerValue :: Maybe Int
$sel:stringValue:StepInput' :: StepInput -> Maybe Text
$sel:mapOfStringValue:StepInput' :: StepInput -> Maybe (HashMap Text Text)
$sel:listOfStringsValue:StepInput' :: StepInput -> Maybe [Text]
$sel:integerValue:StepInput' :: StepInput -> Maybe Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"integerValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
integerValue,
            (Key
"listOfStringsValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
listOfStringsValue,
            (Key
"mapOfStringValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
mapOfStringValue,
            (Key
"stringValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
stringValue
          ]
      )