{-# 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 #-}
module Amazonka.AmplifyUiBuilder.Types.Form where
import Amazonka.AmplifyUiBuilder.Types.FieldConfig
import Amazonka.AmplifyUiBuilder.Types.FormActionType
import Amazonka.AmplifyUiBuilder.Types.FormCTA
import Amazonka.AmplifyUiBuilder.Types.FormDataTypeConfig
import Amazonka.AmplifyUiBuilder.Types.FormStyle
import Amazonka.AmplifyUiBuilder.Types.SectionalElement
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
data Form = Form'
{
Form -> Maybe FormCTA
cta :: Prelude.Maybe FormCTA,
Form -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Form -> Text
appId :: Prelude.Text,
Form -> FormDataTypeConfig
dataType :: FormDataTypeConfig,
Form -> Text
environmentName :: Prelude.Text,
Form -> HashMap Text FieldConfig
fields :: Prelude.HashMap Prelude.Text FieldConfig,
Form -> FormActionType
formActionType :: FormActionType,
Form -> Text
id :: Prelude.Text,
Form -> Text
name :: Prelude.Text,
Form -> Text
schemaVersion :: Prelude.Text,
Form -> HashMap Text SectionalElement
sectionalElements :: Prelude.HashMap Prelude.Text SectionalElement,
Form -> FormStyle
style :: FormStyle
}
deriving (Form -> Form -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Form -> Form -> Bool
$c/= :: Form -> Form -> Bool
== :: Form -> Form -> Bool
$c== :: Form -> Form -> Bool
Prelude.Eq, ReadPrec [Form]
ReadPrec Form
Int -> ReadS Form
ReadS [Form]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Form]
$creadListPrec :: ReadPrec [Form]
readPrec :: ReadPrec Form
$creadPrec :: ReadPrec Form
readList :: ReadS [Form]
$creadList :: ReadS [Form]
readsPrec :: Int -> ReadS Form
$creadsPrec :: Int -> ReadS Form
Prelude.Read, Int -> Form -> ShowS
[Form] -> ShowS
Form -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Form] -> ShowS
$cshowList :: [Form] -> ShowS
show :: Form -> String
$cshow :: Form -> String
showsPrec :: Int -> Form -> ShowS
$cshowsPrec :: Int -> Form -> ShowS
Prelude.Show, forall x. Rep Form x -> Form
forall x. Form -> Rep Form x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Form x -> Form
$cfrom :: forall x. Form -> Rep Form x
Prelude.Generic)
newForm ::
Prelude.Text ->
FormDataTypeConfig ->
Prelude.Text ->
FormActionType ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
FormStyle ->
Form
newForm :: Text
-> FormDataTypeConfig
-> Text
-> FormActionType
-> Text
-> Text
-> Text
-> FormStyle
-> Form
newForm
Text
pAppId_
FormDataTypeConfig
pDataType_
Text
pEnvironmentName_
FormActionType
pFormActionType_
Text
pId_
Text
pName_
Text
pSchemaVersion_
FormStyle
pStyle_ =
Form'
{ $sel:cta:Form' :: Maybe FormCTA
cta = forall a. Maybe a
Prelude.Nothing,
$sel:tags:Form' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:appId:Form' :: Text
appId = Text
pAppId_,
$sel:dataType:Form' :: FormDataTypeConfig
dataType = FormDataTypeConfig
pDataType_,
$sel:environmentName:Form' :: Text
environmentName = Text
pEnvironmentName_,
$sel:fields:Form' :: HashMap Text FieldConfig
fields = forall a. Monoid a => a
Prelude.mempty,
$sel:formActionType:Form' :: FormActionType
formActionType = FormActionType
pFormActionType_,
$sel:id:Form' :: Text
id = Text
pId_,
$sel:name:Form' :: Text
name = Text
pName_,
$sel:schemaVersion:Form' :: Text
schemaVersion = Text
pSchemaVersion_,
$sel:sectionalElements:Form' :: HashMap Text SectionalElement
sectionalElements = forall a. Monoid a => a
Prelude.mempty,
$sel:style:Form' :: FormStyle
style = FormStyle
pStyle_
}
form_cta :: Lens.Lens' Form (Prelude.Maybe FormCTA)
form_cta :: Lens' Form (Maybe FormCTA)
form_cta = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {Maybe FormCTA
cta :: Maybe FormCTA
$sel:cta:Form' :: Form -> Maybe FormCTA
cta} -> Maybe FormCTA
cta) (\s :: Form
s@Form' {} Maybe FormCTA
a -> Form
s {$sel:cta:Form' :: Maybe FormCTA
cta = Maybe FormCTA
a} :: Form)
form_tags :: Lens.Lens' Form (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
form_tags :: Lens' Form (Maybe (HashMap Text Text))
form_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Form' :: Form -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Form
s@Form' {} Maybe (HashMap Text Text)
a -> Form
s {$sel:tags:Form' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: Form) 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
form_appId :: Lens.Lens' Form Prelude.Text
form_appId :: Lens' Form Text
form_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {Text
appId :: Text
$sel:appId:Form' :: Form -> Text
appId} -> Text
appId) (\s :: Form
s@Form' {} Text
a -> Form
s {$sel:appId:Form' :: Text
appId = Text
a} :: Form)
form_dataType :: Lens.Lens' Form FormDataTypeConfig
form_dataType :: Lens' Form FormDataTypeConfig
form_dataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {FormDataTypeConfig
dataType :: FormDataTypeConfig
$sel:dataType:Form' :: Form -> FormDataTypeConfig
dataType} -> FormDataTypeConfig
dataType) (\s :: Form
s@Form' {} FormDataTypeConfig
a -> Form
s {$sel:dataType:Form' :: FormDataTypeConfig
dataType = FormDataTypeConfig
a} :: Form)
form_environmentName :: Lens.Lens' Form Prelude.Text
form_environmentName :: Lens' Form Text
form_environmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {Text
environmentName :: Text
$sel:environmentName:Form' :: Form -> Text
environmentName} -> Text
environmentName) (\s :: Form
s@Form' {} Text
a -> Form
s {$sel:environmentName:Form' :: Text
environmentName = Text
a} :: Form)
form_fields :: Lens.Lens' Form (Prelude.HashMap Prelude.Text FieldConfig)
form_fields :: Lens' Form (HashMap Text FieldConfig)
form_fields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {HashMap Text FieldConfig
fields :: HashMap Text FieldConfig
$sel:fields:Form' :: Form -> HashMap Text FieldConfig
fields} -> HashMap Text FieldConfig
fields) (\s :: Form
s@Form' {} HashMap Text FieldConfig
a -> Form
s {$sel:fields:Form' :: HashMap Text FieldConfig
fields = HashMap Text FieldConfig
a} :: Form) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
form_formActionType :: Lens.Lens' Form FormActionType
form_formActionType :: Lens' Form FormActionType
form_formActionType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {FormActionType
formActionType :: FormActionType
$sel:formActionType:Form' :: Form -> FormActionType
formActionType} -> FormActionType
formActionType) (\s :: Form
s@Form' {} FormActionType
a -> Form
s {$sel:formActionType:Form' :: FormActionType
formActionType = FormActionType
a} :: Form)
form_id :: Lens.Lens' Form Prelude.Text
form_id :: Lens' Form Text
form_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {Text
id :: Text
$sel:id:Form' :: Form -> Text
id} -> Text
id) (\s :: Form
s@Form' {} Text
a -> Form
s {$sel:id:Form' :: Text
id = Text
a} :: Form)
form_name :: Lens.Lens' Form Prelude.Text
form_name :: Lens' Form Text
form_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {Text
name :: Text
$sel:name:Form' :: Form -> Text
name} -> Text
name) (\s :: Form
s@Form' {} Text
a -> Form
s {$sel:name:Form' :: Text
name = Text
a} :: Form)
form_schemaVersion :: Lens.Lens' Form Prelude.Text
form_schemaVersion :: Lens' Form Text
form_schemaVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {Text
schemaVersion :: Text
$sel:schemaVersion:Form' :: Form -> Text
schemaVersion} -> Text
schemaVersion) (\s :: Form
s@Form' {} Text
a -> Form
s {$sel:schemaVersion:Form' :: Text
schemaVersion = Text
a} :: Form)
form_sectionalElements :: Lens.Lens' Form (Prelude.HashMap Prelude.Text SectionalElement)
form_sectionalElements :: Lens' Form (HashMap Text SectionalElement)
form_sectionalElements = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {HashMap Text SectionalElement
sectionalElements :: HashMap Text SectionalElement
$sel:sectionalElements:Form' :: Form -> HashMap Text SectionalElement
sectionalElements} -> HashMap Text SectionalElement
sectionalElements) (\s :: Form
s@Form' {} HashMap Text SectionalElement
a -> Form
s {$sel:sectionalElements:Form' :: HashMap Text SectionalElement
sectionalElements = HashMap Text SectionalElement
a} :: Form) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
form_style :: Lens.Lens' Form FormStyle
form_style :: Lens' Form FormStyle
form_style = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Form' {FormStyle
style :: FormStyle
$sel:style:Form' :: Form -> FormStyle
style} -> FormStyle
style) (\s :: Form
s@Form' {} FormStyle
a -> Form
s {$sel:style:Form' :: FormStyle
style = FormStyle
a} :: Form)
instance Data.FromJSON Form where
parseJSON :: Value -> Parser Form
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Form"
( \Object
x ->
Maybe FormCTA
-> Maybe (HashMap Text Text)
-> Text
-> FormDataTypeConfig
-> Text
-> HashMap Text FieldConfig
-> FormActionType
-> Text
-> Text
-> Text
-> HashMap Text SectionalElement
-> FormStyle
-> Form
Form'
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
"cta")
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
"tags" 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 a
Data..: Key
"appId")
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
"dataType")
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
"environmentName")
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
"fields" 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 a
Data..: Key
"formActionType")
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
"id")
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
"schemaVersion")
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
"sectionalElements"
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 a
Data..: Key
"style")
)
instance Prelude.Hashable Form where
hashWithSalt :: Int -> Form -> Int
hashWithSalt Int
_salt Form' {Maybe (HashMap Text Text)
Maybe FormCTA
Text
HashMap Text SectionalElement
HashMap Text FieldConfig
FormActionType
FormDataTypeConfig
FormStyle
style :: FormStyle
sectionalElements :: HashMap Text SectionalElement
schemaVersion :: Text
name :: Text
id :: Text
formActionType :: FormActionType
fields :: HashMap Text FieldConfig
environmentName :: Text
dataType :: FormDataTypeConfig
appId :: Text
tags :: Maybe (HashMap Text Text)
cta :: Maybe FormCTA
$sel:style:Form' :: Form -> FormStyle
$sel:sectionalElements:Form' :: Form -> HashMap Text SectionalElement
$sel:schemaVersion:Form' :: Form -> Text
$sel:name:Form' :: Form -> Text
$sel:id:Form' :: Form -> Text
$sel:formActionType:Form' :: Form -> FormActionType
$sel:fields:Form' :: Form -> HashMap Text FieldConfig
$sel:environmentName:Form' :: Form -> Text
$sel:dataType:Form' :: Form -> FormDataTypeConfig
$sel:appId:Form' :: Form -> Text
$sel:tags:Form' :: Form -> Maybe (HashMap Text Text)
$sel:cta:Form' :: Form -> Maybe FormCTA
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FormCTA
cta
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FormDataTypeConfig
dataType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
environmentName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text FieldConfig
fields
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FormActionType
formActionType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
schemaVersion
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text SectionalElement
sectionalElements
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FormStyle
style
instance Prelude.NFData Form where
rnf :: Form -> ()
rnf Form' {Maybe (HashMap Text Text)
Maybe FormCTA
Text
HashMap Text SectionalElement
HashMap Text FieldConfig
FormActionType
FormDataTypeConfig
FormStyle
style :: FormStyle
sectionalElements :: HashMap Text SectionalElement
schemaVersion :: Text
name :: Text
id :: Text
formActionType :: FormActionType
fields :: HashMap Text FieldConfig
environmentName :: Text
dataType :: FormDataTypeConfig
appId :: Text
tags :: Maybe (HashMap Text Text)
cta :: Maybe FormCTA
$sel:style:Form' :: Form -> FormStyle
$sel:sectionalElements:Form' :: Form -> HashMap Text SectionalElement
$sel:schemaVersion:Form' :: Form -> Text
$sel:name:Form' :: Form -> Text
$sel:id:Form' :: Form -> Text
$sel:formActionType:Form' :: Form -> FormActionType
$sel:fields:Form' :: Form -> HashMap Text FieldConfig
$sel:environmentName:Form' :: Form -> Text
$sel:dataType:Form' :: Form -> FormDataTypeConfig
$sel:appId:Form' :: Form -> Text
$sel:tags:Form' :: Form -> Maybe (HashMap Text Text)
$sel:cta:Form' :: Form -> Maybe FormCTA
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe FormCTA
cta
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
appId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FormDataTypeConfig
dataType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
environmentName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text FieldConfig
fields
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FormActionType
formActionType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
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
schemaVersion
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text SectionalElement
sectionalElements
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FormStyle
style