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

import Amazonka.AmplifyUiBuilder.Types.FormActionType
import Amazonka.AmplifyUiBuilder.Types.FormDataTypeConfig
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 basic information about a form.
--
-- /See:/ 'newFormSummary' smart constructor.
data FormSummary = FormSummary'
  { -- | The unique ID for the app associated with the form summary.
    FormSummary -> Text
appId :: Prelude.Text,
    -- | The form\'s data source type.
    FormSummary -> FormDataTypeConfig
dataType :: FormDataTypeConfig,
    -- | The name of the backend environment that is part of the Amplify app.
    FormSummary -> Text
environmentName :: Prelude.Text,
    -- | The type of operation to perform on the form.
    FormSummary -> FormActionType
formActionType :: FormActionType,
    -- | The ID of the form.
    FormSummary -> Text
id :: Prelude.Text,
    -- | The name of the form.
    FormSummary -> Text
name :: Prelude.Text
  }
  deriving (FormSummary -> FormSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FormSummary -> FormSummary -> Bool
$c/= :: FormSummary -> FormSummary -> Bool
== :: FormSummary -> FormSummary -> Bool
$c== :: FormSummary -> FormSummary -> Bool
Prelude.Eq, ReadPrec [FormSummary]
ReadPrec FormSummary
Int -> ReadS FormSummary
ReadS [FormSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FormSummary]
$creadListPrec :: ReadPrec [FormSummary]
readPrec :: ReadPrec FormSummary
$creadPrec :: ReadPrec FormSummary
readList :: ReadS [FormSummary]
$creadList :: ReadS [FormSummary]
readsPrec :: Int -> ReadS FormSummary
$creadsPrec :: Int -> ReadS FormSummary
Prelude.Read, Int -> FormSummary -> ShowS
[FormSummary] -> ShowS
FormSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FormSummary] -> ShowS
$cshowList :: [FormSummary] -> ShowS
show :: FormSummary -> String
$cshow :: FormSummary -> String
showsPrec :: Int -> FormSummary -> ShowS
$cshowsPrec :: Int -> FormSummary -> ShowS
Prelude.Show, forall x. Rep FormSummary x -> FormSummary
forall x. FormSummary -> Rep FormSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FormSummary x -> FormSummary
$cfrom :: forall x. FormSummary -> Rep FormSummary x
Prelude.Generic)

-- |
-- Create a value of 'FormSummary' 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:
--
-- 'appId', 'formSummary_appId' - The unique ID for the app associated with the form summary.
--
-- 'dataType', 'formSummary_dataType' - The form\'s data source type.
--
-- 'environmentName', 'formSummary_environmentName' - The name of the backend environment that is part of the Amplify app.
--
-- 'formActionType', 'formSummary_formActionType' - The type of operation to perform on the form.
--
-- 'id', 'formSummary_id' - The ID of the form.
--
-- 'name', 'formSummary_name' - The name of the form.
newFormSummary ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'dataType'
  FormDataTypeConfig ->
  -- | 'environmentName'
  Prelude.Text ->
  -- | 'formActionType'
  FormActionType ->
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  FormSummary
newFormSummary :: Text
-> FormDataTypeConfig
-> Text
-> FormActionType
-> Text
-> Text
-> FormSummary
newFormSummary
  Text
pAppId_
  FormDataTypeConfig
pDataType_
  Text
pEnvironmentName_
  FormActionType
pFormActionType_
  Text
pId_
  Text
pName_ =
    FormSummary'
      { $sel:appId:FormSummary' :: Text
appId = Text
pAppId_,
        $sel:dataType:FormSummary' :: FormDataTypeConfig
dataType = FormDataTypeConfig
pDataType_,
        $sel:environmentName:FormSummary' :: Text
environmentName = Text
pEnvironmentName_,
        $sel:formActionType:FormSummary' :: FormActionType
formActionType = FormActionType
pFormActionType_,
        $sel:id:FormSummary' :: Text
id = Text
pId_,
        $sel:name:FormSummary' :: Text
name = Text
pName_
      }

-- | The unique ID for the app associated with the form summary.
formSummary_appId :: Lens.Lens' FormSummary Prelude.Text
formSummary_appId :: Lens' FormSummary Text
formSummary_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FormSummary' {Text
appId :: Text
$sel:appId:FormSummary' :: FormSummary -> Text
appId} -> Text
appId) (\s :: FormSummary
s@FormSummary' {} Text
a -> FormSummary
s {$sel:appId:FormSummary' :: Text
appId = Text
a} :: FormSummary)

-- | The form\'s data source type.
formSummary_dataType :: Lens.Lens' FormSummary FormDataTypeConfig
formSummary_dataType :: Lens' FormSummary FormDataTypeConfig
formSummary_dataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FormSummary' {FormDataTypeConfig
dataType :: FormDataTypeConfig
$sel:dataType:FormSummary' :: FormSummary -> FormDataTypeConfig
dataType} -> FormDataTypeConfig
dataType) (\s :: FormSummary
s@FormSummary' {} FormDataTypeConfig
a -> FormSummary
s {$sel:dataType:FormSummary' :: FormDataTypeConfig
dataType = FormDataTypeConfig
a} :: FormSummary)

-- | The name of the backend environment that is part of the Amplify app.
formSummary_environmentName :: Lens.Lens' FormSummary Prelude.Text
formSummary_environmentName :: Lens' FormSummary Text
formSummary_environmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FormSummary' {Text
environmentName :: Text
$sel:environmentName:FormSummary' :: FormSummary -> Text
environmentName} -> Text
environmentName) (\s :: FormSummary
s@FormSummary' {} Text
a -> FormSummary
s {$sel:environmentName:FormSummary' :: Text
environmentName = Text
a} :: FormSummary)

-- | The type of operation to perform on the form.
formSummary_formActionType :: Lens.Lens' FormSummary FormActionType
formSummary_formActionType :: Lens' FormSummary FormActionType
formSummary_formActionType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FormSummary' {FormActionType
formActionType :: FormActionType
$sel:formActionType:FormSummary' :: FormSummary -> FormActionType
formActionType} -> FormActionType
formActionType) (\s :: FormSummary
s@FormSummary' {} FormActionType
a -> FormSummary
s {$sel:formActionType:FormSummary' :: FormActionType
formActionType = FormActionType
a} :: FormSummary)

-- | The ID of the form.
formSummary_id :: Lens.Lens' FormSummary Prelude.Text
formSummary_id :: Lens' FormSummary Text
formSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FormSummary' {Text
id :: Text
$sel:id:FormSummary' :: FormSummary -> Text
id} -> Text
id) (\s :: FormSummary
s@FormSummary' {} Text
a -> FormSummary
s {$sel:id:FormSummary' :: Text
id = Text
a} :: FormSummary)

-- | The name of the form.
formSummary_name :: Lens.Lens' FormSummary Prelude.Text
formSummary_name :: Lens' FormSummary Text
formSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FormSummary' {Text
name :: Text
$sel:name:FormSummary' :: FormSummary -> Text
name} -> Text
name) (\s :: FormSummary
s@FormSummary' {} Text
a -> FormSummary
s {$sel:name:FormSummary' :: Text
name = Text
a} :: FormSummary)

instance Data.FromJSON FormSummary where
  parseJSON :: Value -> Parser FormSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FormSummary"
      ( \Object
x ->
          Text
-> FormDataTypeConfig
-> Text
-> FormActionType
-> Text
-> Text
-> FormSummary
FormSummary'
            forall (f :: * -> *) a b. Functor 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 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")
      )

instance Prelude.Hashable FormSummary where
  hashWithSalt :: Int -> FormSummary -> Int
hashWithSalt Int
_salt FormSummary' {Text
FormActionType
FormDataTypeConfig
name :: Text
id :: Text
formActionType :: FormActionType
environmentName :: Text
dataType :: FormDataTypeConfig
appId :: Text
$sel:name:FormSummary' :: FormSummary -> Text
$sel:id:FormSummary' :: FormSummary -> Text
$sel:formActionType:FormSummary' :: FormSummary -> FormActionType
$sel:environmentName:FormSummary' :: FormSummary -> Text
$sel:dataType:FormSummary' :: FormSummary -> FormDataTypeConfig
$sel:appId:FormSummary' :: FormSummary -> Text
..} =
    Int
_salt
      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` FormActionType
formActionType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData FormSummary where
  rnf :: FormSummary -> ()
rnf FormSummary' {Text
FormActionType
FormDataTypeConfig
name :: Text
id :: Text
formActionType :: FormActionType
environmentName :: Text
dataType :: FormDataTypeConfig
appId :: Text
$sel:name:FormSummary' :: FormSummary -> Text
$sel:id:FormSummary' :: FormSummary -> Text
$sel:formActionType:FormSummary' :: FormSummary -> FormActionType
$sel:environmentName:FormSummary' :: FormSummary -> Text
$sel:dataType:FormSummary' :: FormSummary -> FormDataTypeConfig
$sel:appId:FormSummary' :: FormSummary -> Text
..} =
    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 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