{-# 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.ImageBuilder.Types.ComponentParameterDetail
-- 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.ImageBuilder.Types.ComponentParameterDetail 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

-- | Defines a parameter that is used to provide configuration details for
-- the component.
--
-- /See:/ 'newComponentParameterDetail' smart constructor.
data ComponentParameterDetail = ComponentParameterDetail'
  { -- | The default value of this parameter if no input is provided.
    ComponentParameterDetail -> Maybe [Text]
defaultValue :: Prelude.Maybe [Prelude.Text],
    -- | Describes this parameter.
    ComponentParameterDetail -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of this input parameter.
    ComponentParameterDetail -> Text
name :: Prelude.Text,
    -- | The type of input this parameter provides. The currently supported value
    -- is \"string\".
    ComponentParameterDetail -> Text
type' :: Prelude.Text
  }
  deriving (ComponentParameterDetail -> ComponentParameterDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComponentParameterDetail -> ComponentParameterDetail -> Bool
$c/= :: ComponentParameterDetail -> ComponentParameterDetail -> Bool
== :: ComponentParameterDetail -> ComponentParameterDetail -> Bool
$c== :: ComponentParameterDetail -> ComponentParameterDetail -> Bool
Prelude.Eq, ReadPrec [ComponentParameterDetail]
ReadPrec ComponentParameterDetail
Int -> ReadS ComponentParameterDetail
ReadS [ComponentParameterDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComponentParameterDetail]
$creadListPrec :: ReadPrec [ComponentParameterDetail]
readPrec :: ReadPrec ComponentParameterDetail
$creadPrec :: ReadPrec ComponentParameterDetail
readList :: ReadS [ComponentParameterDetail]
$creadList :: ReadS [ComponentParameterDetail]
readsPrec :: Int -> ReadS ComponentParameterDetail
$creadsPrec :: Int -> ReadS ComponentParameterDetail
Prelude.Read, Int -> ComponentParameterDetail -> ShowS
[ComponentParameterDetail] -> ShowS
ComponentParameterDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComponentParameterDetail] -> ShowS
$cshowList :: [ComponentParameterDetail] -> ShowS
show :: ComponentParameterDetail -> String
$cshow :: ComponentParameterDetail -> String
showsPrec :: Int -> ComponentParameterDetail -> ShowS
$cshowsPrec :: Int -> ComponentParameterDetail -> ShowS
Prelude.Show, forall x.
Rep ComponentParameterDetail x -> ComponentParameterDetail
forall x.
ComponentParameterDetail -> Rep ComponentParameterDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ComponentParameterDetail x -> ComponentParameterDetail
$cfrom :: forall x.
ComponentParameterDetail -> Rep ComponentParameterDetail x
Prelude.Generic)

-- |
-- Create a value of 'ComponentParameterDetail' 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:
--
-- 'defaultValue', 'componentParameterDetail_defaultValue' - The default value of this parameter if no input is provided.
--
-- 'description', 'componentParameterDetail_description' - Describes this parameter.
--
-- 'name', 'componentParameterDetail_name' - The name of this input parameter.
--
-- 'type'', 'componentParameterDetail_type' - The type of input this parameter provides. The currently supported value
-- is \"string\".
newComponentParameterDetail ::
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  Prelude.Text ->
  ComponentParameterDetail
newComponentParameterDetail :: Text -> Text -> ComponentParameterDetail
newComponentParameterDetail Text
pName_ Text
pType_ =
  ComponentParameterDetail'
    { $sel:defaultValue:ComponentParameterDetail' :: Maybe [Text]
defaultValue =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:ComponentParameterDetail' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ComponentParameterDetail' :: Text
name = Text
pName_,
      $sel:type':ComponentParameterDetail' :: Text
type' = Text
pType_
    }

-- | The default value of this parameter if no input is provided.
componentParameterDetail_defaultValue :: Lens.Lens' ComponentParameterDetail (Prelude.Maybe [Prelude.Text])
componentParameterDetail_defaultValue :: Lens' ComponentParameterDetail (Maybe [Text])
componentParameterDetail_defaultValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentParameterDetail' {Maybe [Text]
defaultValue :: Maybe [Text]
$sel:defaultValue:ComponentParameterDetail' :: ComponentParameterDetail -> Maybe [Text]
defaultValue} -> Maybe [Text]
defaultValue) (\s :: ComponentParameterDetail
s@ComponentParameterDetail' {} Maybe [Text]
a -> ComponentParameterDetail
s {$sel:defaultValue:ComponentParameterDetail' :: Maybe [Text]
defaultValue = Maybe [Text]
a} :: ComponentParameterDetail) 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

-- | Describes this parameter.
componentParameterDetail_description :: Lens.Lens' ComponentParameterDetail (Prelude.Maybe Prelude.Text)
componentParameterDetail_description :: Lens' ComponentParameterDetail (Maybe Text)
componentParameterDetail_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentParameterDetail' {Maybe Text
description :: Maybe Text
$sel:description:ComponentParameterDetail' :: ComponentParameterDetail -> Maybe Text
description} -> Maybe Text
description) (\s :: ComponentParameterDetail
s@ComponentParameterDetail' {} Maybe Text
a -> ComponentParameterDetail
s {$sel:description:ComponentParameterDetail' :: Maybe Text
description = Maybe Text
a} :: ComponentParameterDetail)

-- | The name of this input parameter.
componentParameterDetail_name :: Lens.Lens' ComponentParameterDetail Prelude.Text
componentParameterDetail_name :: Lens' ComponentParameterDetail Text
componentParameterDetail_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentParameterDetail' {Text
name :: Text
$sel:name:ComponentParameterDetail' :: ComponentParameterDetail -> Text
name} -> Text
name) (\s :: ComponentParameterDetail
s@ComponentParameterDetail' {} Text
a -> ComponentParameterDetail
s {$sel:name:ComponentParameterDetail' :: Text
name = Text
a} :: ComponentParameterDetail)

-- | The type of input this parameter provides. The currently supported value
-- is \"string\".
componentParameterDetail_type :: Lens.Lens' ComponentParameterDetail Prelude.Text
componentParameterDetail_type :: Lens' ComponentParameterDetail Text
componentParameterDetail_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentParameterDetail' {Text
type' :: Text
$sel:type':ComponentParameterDetail' :: ComponentParameterDetail -> Text
type'} -> Text
type') (\s :: ComponentParameterDetail
s@ComponentParameterDetail' {} Text
a -> ComponentParameterDetail
s {$sel:type':ComponentParameterDetail' :: Text
type' = Text
a} :: ComponentParameterDetail)

instance Data.FromJSON ComponentParameterDetail where
  parseJSON :: Value -> Parser ComponentParameterDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ComponentParameterDetail"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text -> Text -> Text -> ComponentParameterDetail
ComponentParameterDetail'
            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
"defaultValue" 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
"description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"type")
      )

instance Prelude.Hashable ComponentParameterDetail where
  hashWithSalt :: Int -> ComponentParameterDetail -> Int
hashWithSalt Int
_salt ComponentParameterDetail' {Maybe [Text]
Maybe Text
Text
type' :: Text
name :: Text
description :: Maybe Text
defaultValue :: Maybe [Text]
$sel:type':ComponentParameterDetail' :: ComponentParameterDetail -> Text
$sel:name:ComponentParameterDetail' :: ComponentParameterDetail -> Text
$sel:description:ComponentParameterDetail' :: ComponentParameterDetail -> Maybe Text
$sel:defaultValue:ComponentParameterDetail' :: ComponentParameterDetail -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
defaultValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
type'

instance Prelude.NFData ComponentParameterDetail where
  rnf :: ComponentParameterDetail -> ()
rnf ComponentParameterDetail' {Maybe [Text]
Maybe Text
Text
type' :: Text
name :: Text
description :: Maybe Text
defaultValue :: Maybe [Text]
$sel:type':ComponentParameterDetail' :: ComponentParameterDetail -> Text
$sel:name:ComponentParameterDetail' :: ComponentParameterDetail -> Text
$sel:description:ComponentParameterDetail' :: ComponentParameterDetail -> Maybe Text
$sel:defaultValue:ComponentParameterDetail' :: ComponentParameterDetail -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
defaultValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
type'