{-# 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.CognitoIdentityProvider.Types.SchemaAttributeType
-- 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.CognitoIdentityProvider.Types.SchemaAttributeType where

import Amazonka.CognitoIdentityProvider.Types.AttributeDataType
import Amazonka.CognitoIdentityProvider.Types.NumberAttributeConstraintsType
import Amazonka.CognitoIdentityProvider.Types.StringAttributeConstraintsType
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

-- | Contains information about the schema attribute.
--
-- /See:/ 'newSchemaAttributeType' smart constructor.
data SchemaAttributeType = SchemaAttributeType'
  { -- | The attribute data type.
    SchemaAttributeType -> Maybe AttributeDataType
attributeDataType :: Prelude.Maybe AttributeDataType,
    -- | You should use
    -- <https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UserPoolClientType.html#CognitoUserPools-Type-UserPoolClientType-WriteAttributes WriteAttributes>
    -- in the user pool client to control how attributes can be mutated for new
    -- use cases instead of using @DeveloperOnlyAttribute@.
    --
    -- Specifies whether the attribute type is developer only. This attribute
    -- can only be modified by an administrator. Users won\'t be able to modify
    -- this attribute using their access token. For example,
    -- @DeveloperOnlyAttribute@ can be modified using AdminUpdateUserAttributes
    -- but can\'t be updated using UpdateUserAttributes.
    SchemaAttributeType -> Maybe Bool
developerOnlyAttribute :: Prelude.Maybe Prelude.Bool,
    -- | Specifies whether the value of the attribute can be changed.
    --
    -- For any user pool attribute that is mapped to an IdP attribute, you must
    -- set this parameter to @true@. Amazon Cognito updates mapped attributes
    -- when users sign in to your application through an IdP. If an attribute
    -- is immutable, Amazon Cognito throws an error when it attempts to update
    -- the attribute. For more information, see
    -- <https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-specifying-attribute-mapping.html Specifying Identity Provider Attribute Mappings for Your User Pool>.
    SchemaAttributeType -> Maybe Bool
mutable :: Prelude.Maybe Prelude.Bool,
    -- | A schema attribute of the name type.
    SchemaAttributeType -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Specifies the constraints for an attribute of the number type.
    SchemaAttributeType -> Maybe NumberAttributeConstraintsType
numberAttributeConstraints :: Prelude.Maybe NumberAttributeConstraintsType,
    -- | Specifies whether a user pool attribute is required. If the attribute is
    -- required and the user doesn\'t provide a value, registration or sign-in
    -- will fail.
    SchemaAttributeType -> Maybe Bool
required :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the constraints for an attribute of the string type.
    SchemaAttributeType -> Maybe StringAttributeConstraintsType
stringAttributeConstraints :: Prelude.Maybe StringAttributeConstraintsType
  }
  deriving (SchemaAttributeType -> SchemaAttributeType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SchemaAttributeType -> SchemaAttributeType -> Bool
$c/= :: SchemaAttributeType -> SchemaAttributeType -> Bool
== :: SchemaAttributeType -> SchemaAttributeType -> Bool
$c== :: SchemaAttributeType -> SchemaAttributeType -> Bool
Prelude.Eq, ReadPrec [SchemaAttributeType]
ReadPrec SchemaAttributeType
Int -> ReadS SchemaAttributeType
ReadS [SchemaAttributeType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SchemaAttributeType]
$creadListPrec :: ReadPrec [SchemaAttributeType]
readPrec :: ReadPrec SchemaAttributeType
$creadPrec :: ReadPrec SchemaAttributeType
readList :: ReadS [SchemaAttributeType]
$creadList :: ReadS [SchemaAttributeType]
readsPrec :: Int -> ReadS SchemaAttributeType
$creadsPrec :: Int -> ReadS SchemaAttributeType
Prelude.Read, Int -> SchemaAttributeType -> ShowS
[SchemaAttributeType] -> ShowS
SchemaAttributeType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SchemaAttributeType] -> ShowS
$cshowList :: [SchemaAttributeType] -> ShowS
show :: SchemaAttributeType -> String
$cshow :: SchemaAttributeType -> String
showsPrec :: Int -> SchemaAttributeType -> ShowS
$cshowsPrec :: Int -> SchemaAttributeType -> ShowS
Prelude.Show, forall x. Rep SchemaAttributeType x -> SchemaAttributeType
forall x. SchemaAttributeType -> Rep SchemaAttributeType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SchemaAttributeType x -> SchemaAttributeType
$cfrom :: forall x. SchemaAttributeType -> Rep SchemaAttributeType x
Prelude.Generic)

-- |
-- Create a value of 'SchemaAttributeType' 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:
--
-- 'attributeDataType', 'schemaAttributeType_attributeDataType' - The attribute data type.
--
-- 'developerOnlyAttribute', 'schemaAttributeType_developerOnlyAttribute' - You should use
-- <https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UserPoolClientType.html#CognitoUserPools-Type-UserPoolClientType-WriteAttributes WriteAttributes>
-- in the user pool client to control how attributes can be mutated for new
-- use cases instead of using @DeveloperOnlyAttribute@.
--
-- Specifies whether the attribute type is developer only. This attribute
-- can only be modified by an administrator. Users won\'t be able to modify
-- this attribute using their access token. For example,
-- @DeveloperOnlyAttribute@ can be modified using AdminUpdateUserAttributes
-- but can\'t be updated using UpdateUserAttributes.
--
-- 'mutable', 'schemaAttributeType_mutable' - Specifies whether the value of the attribute can be changed.
--
-- For any user pool attribute that is mapped to an IdP attribute, you must
-- set this parameter to @true@. Amazon Cognito updates mapped attributes
-- when users sign in to your application through an IdP. If an attribute
-- is immutable, Amazon Cognito throws an error when it attempts to update
-- the attribute. For more information, see
-- <https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-specifying-attribute-mapping.html Specifying Identity Provider Attribute Mappings for Your User Pool>.
--
-- 'name', 'schemaAttributeType_name' - A schema attribute of the name type.
--
-- 'numberAttributeConstraints', 'schemaAttributeType_numberAttributeConstraints' - Specifies the constraints for an attribute of the number type.
--
-- 'required', 'schemaAttributeType_required' - Specifies whether a user pool attribute is required. If the attribute is
-- required and the user doesn\'t provide a value, registration or sign-in
-- will fail.
--
-- 'stringAttributeConstraints', 'schemaAttributeType_stringAttributeConstraints' - Specifies the constraints for an attribute of the string type.
newSchemaAttributeType ::
  SchemaAttributeType
newSchemaAttributeType :: SchemaAttributeType
newSchemaAttributeType =
  SchemaAttributeType'
    { $sel:attributeDataType:SchemaAttributeType' :: Maybe AttributeDataType
attributeDataType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:developerOnlyAttribute:SchemaAttributeType' :: Maybe Bool
developerOnlyAttribute = forall a. Maybe a
Prelude.Nothing,
      $sel:mutable:SchemaAttributeType' :: Maybe Bool
mutable = forall a. Maybe a
Prelude.Nothing,
      $sel:name:SchemaAttributeType' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:numberAttributeConstraints:SchemaAttributeType' :: Maybe NumberAttributeConstraintsType
numberAttributeConstraints = forall a. Maybe a
Prelude.Nothing,
      $sel:required:SchemaAttributeType' :: Maybe Bool
required = forall a. Maybe a
Prelude.Nothing,
      $sel:stringAttributeConstraints:SchemaAttributeType' :: Maybe StringAttributeConstraintsType
stringAttributeConstraints = forall a. Maybe a
Prelude.Nothing
    }

-- | The attribute data type.
schemaAttributeType_attributeDataType :: Lens.Lens' SchemaAttributeType (Prelude.Maybe AttributeDataType)
schemaAttributeType_attributeDataType :: Lens' SchemaAttributeType (Maybe AttributeDataType)
schemaAttributeType_attributeDataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaAttributeType' {Maybe AttributeDataType
attributeDataType :: Maybe AttributeDataType
$sel:attributeDataType:SchemaAttributeType' :: SchemaAttributeType -> Maybe AttributeDataType
attributeDataType} -> Maybe AttributeDataType
attributeDataType) (\s :: SchemaAttributeType
s@SchemaAttributeType' {} Maybe AttributeDataType
a -> SchemaAttributeType
s {$sel:attributeDataType:SchemaAttributeType' :: Maybe AttributeDataType
attributeDataType = Maybe AttributeDataType
a} :: SchemaAttributeType)

-- | You should use
-- <https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UserPoolClientType.html#CognitoUserPools-Type-UserPoolClientType-WriteAttributes WriteAttributes>
-- in the user pool client to control how attributes can be mutated for new
-- use cases instead of using @DeveloperOnlyAttribute@.
--
-- Specifies whether the attribute type is developer only. This attribute
-- can only be modified by an administrator. Users won\'t be able to modify
-- this attribute using their access token. For example,
-- @DeveloperOnlyAttribute@ can be modified using AdminUpdateUserAttributes
-- but can\'t be updated using UpdateUserAttributes.
schemaAttributeType_developerOnlyAttribute :: Lens.Lens' SchemaAttributeType (Prelude.Maybe Prelude.Bool)
schemaAttributeType_developerOnlyAttribute :: Lens' SchemaAttributeType (Maybe Bool)
schemaAttributeType_developerOnlyAttribute = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaAttributeType' {Maybe Bool
developerOnlyAttribute :: Maybe Bool
$sel:developerOnlyAttribute:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
developerOnlyAttribute} -> Maybe Bool
developerOnlyAttribute) (\s :: SchemaAttributeType
s@SchemaAttributeType' {} Maybe Bool
a -> SchemaAttributeType
s {$sel:developerOnlyAttribute:SchemaAttributeType' :: Maybe Bool
developerOnlyAttribute = Maybe Bool
a} :: SchemaAttributeType)

-- | Specifies whether the value of the attribute can be changed.
--
-- For any user pool attribute that is mapped to an IdP attribute, you must
-- set this parameter to @true@. Amazon Cognito updates mapped attributes
-- when users sign in to your application through an IdP. If an attribute
-- is immutable, Amazon Cognito throws an error when it attempts to update
-- the attribute. For more information, see
-- <https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-specifying-attribute-mapping.html Specifying Identity Provider Attribute Mappings for Your User Pool>.
schemaAttributeType_mutable :: Lens.Lens' SchemaAttributeType (Prelude.Maybe Prelude.Bool)
schemaAttributeType_mutable :: Lens' SchemaAttributeType (Maybe Bool)
schemaAttributeType_mutable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaAttributeType' {Maybe Bool
mutable :: Maybe Bool
$sel:mutable:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
mutable} -> Maybe Bool
mutable) (\s :: SchemaAttributeType
s@SchemaAttributeType' {} Maybe Bool
a -> SchemaAttributeType
s {$sel:mutable:SchemaAttributeType' :: Maybe Bool
mutable = Maybe Bool
a} :: SchemaAttributeType)

-- | A schema attribute of the name type.
schemaAttributeType_name :: Lens.Lens' SchemaAttributeType (Prelude.Maybe Prelude.Text)
schemaAttributeType_name :: Lens' SchemaAttributeType (Maybe Text)
schemaAttributeType_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaAttributeType' {Maybe Text
name :: Maybe Text
$sel:name:SchemaAttributeType' :: SchemaAttributeType -> Maybe Text
name} -> Maybe Text
name) (\s :: SchemaAttributeType
s@SchemaAttributeType' {} Maybe Text
a -> SchemaAttributeType
s {$sel:name:SchemaAttributeType' :: Maybe Text
name = Maybe Text
a} :: SchemaAttributeType)

-- | Specifies the constraints for an attribute of the number type.
schemaAttributeType_numberAttributeConstraints :: Lens.Lens' SchemaAttributeType (Prelude.Maybe NumberAttributeConstraintsType)
schemaAttributeType_numberAttributeConstraints :: Lens' SchemaAttributeType (Maybe NumberAttributeConstraintsType)
schemaAttributeType_numberAttributeConstraints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaAttributeType' {Maybe NumberAttributeConstraintsType
numberAttributeConstraints :: Maybe NumberAttributeConstraintsType
$sel:numberAttributeConstraints:SchemaAttributeType' :: SchemaAttributeType -> Maybe NumberAttributeConstraintsType
numberAttributeConstraints} -> Maybe NumberAttributeConstraintsType
numberAttributeConstraints) (\s :: SchemaAttributeType
s@SchemaAttributeType' {} Maybe NumberAttributeConstraintsType
a -> SchemaAttributeType
s {$sel:numberAttributeConstraints:SchemaAttributeType' :: Maybe NumberAttributeConstraintsType
numberAttributeConstraints = Maybe NumberAttributeConstraintsType
a} :: SchemaAttributeType)

-- | Specifies whether a user pool attribute is required. If the attribute is
-- required and the user doesn\'t provide a value, registration or sign-in
-- will fail.
schemaAttributeType_required :: Lens.Lens' SchemaAttributeType (Prelude.Maybe Prelude.Bool)
schemaAttributeType_required :: Lens' SchemaAttributeType (Maybe Bool)
schemaAttributeType_required = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaAttributeType' {Maybe Bool
required :: Maybe Bool
$sel:required:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
required} -> Maybe Bool
required) (\s :: SchemaAttributeType
s@SchemaAttributeType' {} Maybe Bool
a -> SchemaAttributeType
s {$sel:required:SchemaAttributeType' :: Maybe Bool
required = Maybe Bool
a} :: SchemaAttributeType)

-- | Specifies the constraints for an attribute of the string type.
schemaAttributeType_stringAttributeConstraints :: Lens.Lens' SchemaAttributeType (Prelude.Maybe StringAttributeConstraintsType)
schemaAttributeType_stringAttributeConstraints :: Lens' SchemaAttributeType (Maybe StringAttributeConstraintsType)
schemaAttributeType_stringAttributeConstraints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaAttributeType' {Maybe StringAttributeConstraintsType
stringAttributeConstraints :: Maybe StringAttributeConstraintsType
$sel:stringAttributeConstraints:SchemaAttributeType' :: SchemaAttributeType -> Maybe StringAttributeConstraintsType
stringAttributeConstraints} -> Maybe StringAttributeConstraintsType
stringAttributeConstraints) (\s :: SchemaAttributeType
s@SchemaAttributeType' {} Maybe StringAttributeConstraintsType
a -> SchemaAttributeType
s {$sel:stringAttributeConstraints:SchemaAttributeType' :: Maybe StringAttributeConstraintsType
stringAttributeConstraints = Maybe StringAttributeConstraintsType
a} :: SchemaAttributeType)

instance Data.FromJSON SchemaAttributeType where
  parseJSON :: Value -> Parser SchemaAttributeType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SchemaAttributeType"
      ( \Object
x ->
          Maybe AttributeDataType
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe NumberAttributeConstraintsType
-> Maybe Bool
-> Maybe StringAttributeConstraintsType
-> SchemaAttributeType
SchemaAttributeType'
            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
"AttributeDataType")
            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
"DeveloperOnlyAttribute")
            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
"Mutable")
            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
"Name")
            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
"NumberAttributeConstraints")
            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")
            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
"StringAttributeConstraints")
      )

instance Prelude.Hashable SchemaAttributeType where
  hashWithSalt :: Int -> SchemaAttributeType -> Int
hashWithSalt Int
_salt SchemaAttributeType' {Maybe Bool
Maybe Text
Maybe AttributeDataType
Maybe NumberAttributeConstraintsType
Maybe StringAttributeConstraintsType
stringAttributeConstraints :: Maybe StringAttributeConstraintsType
required :: Maybe Bool
numberAttributeConstraints :: Maybe NumberAttributeConstraintsType
name :: Maybe Text
mutable :: Maybe Bool
developerOnlyAttribute :: Maybe Bool
attributeDataType :: Maybe AttributeDataType
$sel:stringAttributeConstraints:SchemaAttributeType' :: SchemaAttributeType -> Maybe StringAttributeConstraintsType
$sel:required:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
$sel:numberAttributeConstraints:SchemaAttributeType' :: SchemaAttributeType -> Maybe NumberAttributeConstraintsType
$sel:name:SchemaAttributeType' :: SchemaAttributeType -> Maybe Text
$sel:mutable:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
$sel:developerOnlyAttribute:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
$sel:attributeDataType:SchemaAttributeType' :: SchemaAttributeType -> Maybe AttributeDataType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AttributeDataType
attributeDataType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
developerOnlyAttribute
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
mutable
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NumberAttributeConstraintsType
numberAttributeConstraints
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
required
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StringAttributeConstraintsType
stringAttributeConstraints

instance Prelude.NFData SchemaAttributeType where
  rnf :: SchemaAttributeType -> ()
rnf SchemaAttributeType' {Maybe Bool
Maybe Text
Maybe AttributeDataType
Maybe NumberAttributeConstraintsType
Maybe StringAttributeConstraintsType
stringAttributeConstraints :: Maybe StringAttributeConstraintsType
required :: Maybe Bool
numberAttributeConstraints :: Maybe NumberAttributeConstraintsType
name :: Maybe Text
mutable :: Maybe Bool
developerOnlyAttribute :: Maybe Bool
attributeDataType :: Maybe AttributeDataType
$sel:stringAttributeConstraints:SchemaAttributeType' :: SchemaAttributeType -> Maybe StringAttributeConstraintsType
$sel:required:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
$sel:numberAttributeConstraints:SchemaAttributeType' :: SchemaAttributeType -> Maybe NumberAttributeConstraintsType
$sel:name:SchemaAttributeType' :: SchemaAttributeType -> Maybe Text
$sel:mutable:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
$sel:developerOnlyAttribute:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
$sel:attributeDataType:SchemaAttributeType' :: SchemaAttributeType -> Maybe AttributeDataType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AttributeDataType
attributeDataType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
developerOnlyAttribute
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
mutable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NumberAttributeConstraintsType
numberAttributeConstraints
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
required
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StringAttributeConstraintsType
stringAttributeConstraints

instance Data.ToJSON SchemaAttributeType where
  toJSON :: SchemaAttributeType -> Value
toJSON SchemaAttributeType' {Maybe Bool
Maybe Text
Maybe AttributeDataType
Maybe NumberAttributeConstraintsType
Maybe StringAttributeConstraintsType
stringAttributeConstraints :: Maybe StringAttributeConstraintsType
required :: Maybe Bool
numberAttributeConstraints :: Maybe NumberAttributeConstraintsType
name :: Maybe Text
mutable :: Maybe Bool
developerOnlyAttribute :: Maybe Bool
attributeDataType :: Maybe AttributeDataType
$sel:stringAttributeConstraints:SchemaAttributeType' :: SchemaAttributeType -> Maybe StringAttributeConstraintsType
$sel:required:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
$sel:numberAttributeConstraints:SchemaAttributeType' :: SchemaAttributeType -> Maybe NumberAttributeConstraintsType
$sel:name:SchemaAttributeType' :: SchemaAttributeType -> Maybe Text
$sel:mutable:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
$sel:developerOnlyAttribute:SchemaAttributeType' :: SchemaAttributeType -> Maybe Bool
$sel:attributeDataType:SchemaAttributeType' :: SchemaAttributeType -> Maybe AttributeDataType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AttributeDataType" 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 AttributeDataType
attributeDataType,
            (Key
"DeveloperOnlyAttribute" 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 Bool
developerOnlyAttribute,
            (Key
"Mutable" 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 Bool
mutable,
            (Key
"Name" 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
name,
            (Key
"NumberAttributeConstraints" 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 NumberAttributeConstraintsType
numberAttributeConstraints,
            (Key
"Required" 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 Bool
required,
            (Key
"StringAttributeConstraints" 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 StringAttributeConstraintsType
stringAttributeConstraints
          ]
      )