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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubOrchestrator.Types.DataType
import qualified Amazonka.Prelude as Prelude

-- | The input parameters of a template.
--
-- /See:/ 'newTemplateInput' smart constructor.
data TemplateInput = TemplateInput'
  { -- | The data type of the template input.
    TemplateInput -> Maybe DataType
dataType :: Prelude.Maybe DataType,
    -- | The name of the template.
    TemplateInput -> Maybe Text
inputName :: Prelude.Maybe Prelude.Text,
    -- | Determine if an input is required from the template.
    TemplateInput -> Maybe Bool
required :: Prelude.Maybe Prelude.Bool
  }
  deriving (TemplateInput -> TemplateInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateInput -> TemplateInput -> Bool
$c/= :: TemplateInput -> TemplateInput -> Bool
== :: TemplateInput -> TemplateInput -> Bool
$c== :: TemplateInput -> TemplateInput -> Bool
Prelude.Eq, ReadPrec [TemplateInput]
ReadPrec TemplateInput
Int -> ReadS TemplateInput
ReadS [TemplateInput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateInput]
$creadListPrec :: ReadPrec [TemplateInput]
readPrec :: ReadPrec TemplateInput
$creadPrec :: ReadPrec TemplateInput
readList :: ReadS [TemplateInput]
$creadList :: ReadS [TemplateInput]
readsPrec :: Int -> ReadS TemplateInput
$creadsPrec :: Int -> ReadS TemplateInput
Prelude.Read, Int -> TemplateInput -> ShowS
[TemplateInput] -> ShowS
TemplateInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateInput] -> ShowS
$cshowList :: [TemplateInput] -> ShowS
show :: TemplateInput -> String
$cshow :: TemplateInput -> String
showsPrec :: Int -> TemplateInput -> ShowS
$cshowsPrec :: Int -> TemplateInput -> ShowS
Prelude.Show, forall x. Rep TemplateInput x -> TemplateInput
forall x. TemplateInput -> Rep TemplateInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TemplateInput x -> TemplateInput
$cfrom :: forall x. TemplateInput -> Rep TemplateInput x
Prelude.Generic)

-- |
-- Create a value of 'TemplateInput' 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:
--
-- 'dataType', 'templateInput_dataType' - The data type of the template input.
--
-- 'inputName', 'templateInput_inputName' - The name of the template.
--
-- 'required', 'templateInput_required' - Determine if an input is required from the template.
newTemplateInput ::
  TemplateInput
newTemplateInput :: TemplateInput
newTemplateInput =
  TemplateInput'
    { $sel:dataType:TemplateInput' :: Maybe DataType
dataType = forall a. Maybe a
Prelude.Nothing,
      $sel:inputName:TemplateInput' :: Maybe Text
inputName = forall a. Maybe a
Prelude.Nothing,
      $sel:required:TemplateInput' :: Maybe Bool
required = forall a. Maybe a
Prelude.Nothing
    }

-- | The data type of the template input.
templateInput_dataType :: Lens.Lens' TemplateInput (Prelude.Maybe DataType)
templateInput_dataType :: Lens' TemplateInput (Maybe DataType)
templateInput_dataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateInput' {Maybe DataType
dataType :: Maybe DataType
$sel:dataType:TemplateInput' :: TemplateInput -> Maybe DataType
dataType} -> Maybe DataType
dataType) (\s :: TemplateInput
s@TemplateInput' {} Maybe DataType
a -> TemplateInput
s {$sel:dataType:TemplateInput' :: Maybe DataType
dataType = Maybe DataType
a} :: TemplateInput)

-- | The name of the template.
templateInput_inputName :: Lens.Lens' TemplateInput (Prelude.Maybe Prelude.Text)
templateInput_inputName :: Lens' TemplateInput (Maybe Text)
templateInput_inputName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateInput' {Maybe Text
inputName :: Maybe Text
$sel:inputName:TemplateInput' :: TemplateInput -> Maybe Text
inputName} -> Maybe Text
inputName) (\s :: TemplateInput
s@TemplateInput' {} Maybe Text
a -> TemplateInput
s {$sel:inputName:TemplateInput' :: Maybe Text
inputName = Maybe Text
a} :: TemplateInput)

-- | Determine if an input is required from the template.
templateInput_required :: Lens.Lens' TemplateInput (Prelude.Maybe Prelude.Bool)
templateInput_required :: Lens' TemplateInput (Maybe Bool)
templateInput_required = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateInput' {Maybe Bool
required :: Maybe Bool
$sel:required:TemplateInput' :: TemplateInput -> Maybe Bool
required} -> Maybe Bool
required) (\s :: TemplateInput
s@TemplateInput' {} Maybe Bool
a -> TemplateInput
s {$sel:required:TemplateInput' :: Maybe Bool
required = Maybe Bool
a} :: TemplateInput)

instance Data.FromJSON TemplateInput where
  parseJSON :: Value -> Parser TemplateInput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TemplateInput"
      ( \Object
x ->
          Maybe DataType -> Maybe Text -> Maybe Bool -> TemplateInput
TemplateInput'
            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
"dataType")
            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
"inputName")
            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
"required")
      )

instance Prelude.Hashable TemplateInput where
  hashWithSalt :: Int -> TemplateInput -> Int
hashWithSalt Int
_salt TemplateInput' {Maybe Bool
Maybe Text
Maybe DataType
required :: Maybe Bool
inputName :: Maybe Text
dataType :: Maybe DataType
$sel:required:TemplateInput' :: TemplateInput -> Maybe Bool
$sel:inputName:TemplateInput' :: TemplateInput -> Maybe Text
$sel:dataType:TemplateInput' :: TemplateInput -> Maybe DataType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataType
dataType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inputName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
required

instance Prelude.NFData TemplateInput where
  rnf :: TemplateInput -> ()
rnf TemplateInput' {Maybe Bool
Maybe Text
Maybe DataType
required :: Maybe Bool
inputName :: Maybe Text
dataType :: Maybe DataType
$sel:required:TemplateInput' :: TemplateInput -> Maybe Bool
$sel:inputName:TemplateInput' :: TemplateInput -> Maybe Text
$sel:dataType:TemplateInput' :: TemplateInput -> Maybe DataType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DataType
dataType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inputName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
required