{-# 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.AmplifyUiBuilder.Types.FormInputValueProperty
-- 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.AmplifyUiBuilder.Types.FormInputValueProperty 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

-- | Describes the configuration for an input field on a form. Use
-- @FormInputValueProperty@ to specify the values to render or bind by
-- default.
--
-- /See:/ 'newFormInputValueProperty' smart constructor.
data FormInputValueProperty = FormInputValueProperty'
  { -- | The value to assign to the input field.
    FormInputValueProperty -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (FormInputValueProperty -> FormInputValueProperty -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FormInputValueProperty -> FormInputValueProperty -> Bool
$c/= :: FormInputValueProperty -> FormInputValueProperty -> Bool
== :: FormInputValueProperty -> FormInputValueProperty -> Bool
$c== :: FormInputValueProperty -> FormInputValueProperty -> Bool
Prelude.Eq, ReadPrec [FormInputValueProperty]
ReadPrec FormInputValueProperty
Int -> ReadS FormInputValueProperty
ReadS [FormInputValueProperty]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FormInputValueProperty]
$creadListPrec :: ReadPrec [FormInputValueProperty]
readPrec :: ReadPrec FormInputValueProperty
$creadPrec :: ReadPrec FormInputValueProperty
readList :: ReadS [FormInputValueProperty]
$creadList :: ReadS [FormInputValueProperty]
readsPrec :: Int -> ReadS FormInputValueProperty
$creadsPrec :: Int -> ReadS FormInputValueProperty
Prelude.Read, Int -> FormInputValueProperty -> ShowS
[FormInputValueProperty] -> ShowS
FormInputValueProperty -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FormInputValueProperty] -> ShowS
$cshowList :: [FormInputValueProperty] -> ShowS
show :: FormInputValueProperty -> String
$cshow :: FormInputValueProperty -> String
showsPrec :: Int -> FormInputValueProperty -> ShowS
$cshowsPrec :: Int -> FormInputValueProperty -> ShowS
Prelude.Show, forall x. Rep FormInputValueProperty x -> FormInputValueProperty
forall x. FormInputValueProperty -> Rep FormInputValueProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FormInputValueProperty x -> FormInputValueProperty
$cfrom :: forall x. FormInputValueProperty -> Rep FormInputValueProperty x
Prelude.Generic)

-- |
-- Create a value of 'FormInputValueProperty' 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:
--
-- 'value', 'formInputValueProperty_value' - The value to assign to the input field.
newFormInputValueProperty ::
  FormInputValueProperty
newFormInputValueProperty :: FormInputValueProperty
newFormInputValueProperty =
  FormInputValueProperty' {$sel:value:FormInputValueProperty' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing}

-- | The value to assign to the input field.
formInputValueProperty_value :: Lens.Lens' FormInputValueProperty (Prelude.Maybe Prelude.Text)
formInputValueProperty_value :: Lens' FormInputValueProperty (Maybe Text)
formInputValueProperty_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FormInputValueProperty' {Maybe Text
value :: Maybe Text
$sel:value:FormInputValueProperty' :: FormInputValueProperty -> Maybe Text
value} -> Maybe Text
value) (\s :: FormInputValueProperty
s@FormInputValueProperty' {} Maybe Text
a -> FormInputValueProperty
s {$sel:value:FormInputValueProperty' :: Maybe Text
value = Maybe Text
a} :: FormInputValueProperty)

instance Data.FromJSON FormInputValueProperty where
  parseJSON :: Value -> Parser FormInputValueProperty
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FormInputValueProperty"
      ( \Object
x ->
          Maybe Text -> FormInputValueProperty
FormInputValueProperty'
            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
"value")
      )

instance Prelude.Hashable FormInputValueProperty where
  hashWithSalt :: Int -> FormInputValueProperty -> Int
hashWithSalt Int
_salt FormInputValueProperty' {Maybe Text
value :: Maybe Text
$sel:value:FormInputValueProperty' :: FormInputValueProperty -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData FormInputValueProperty where
  rnf :: FormInputValueProperty -> ()
rnf FormInputValueProperty' {Maybe Text
value :: Maybe Text
$sel:value:FormInputValueProperty' :: FormInputValueProperty -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value

instance Data.ToJSON FormInputValueProperty where
  toJSON :: FormInputValueProperty -> Value
toJSON FormInputValueProperty' {Maybe Text
value :: Maybe Text
$sel:value:FormInputValueProperty' :: FormInputValueProperty -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"value" 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
value]
      )