{-# 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.AmplifyBackend.Types.CreateBackendAuthUserPoolConfig
-- 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.AmplifyBackend.Types.CreateBackendAuthUserPoolConfig where

import Amazonka.AmplifyBackend.Types.CreateBackendAuthForgotPasswordConfig
import Amazonka.AmplifyBackend.Types.CreateBackendAuthMFAConfig
import Amazonka.AmplifyBackend.Types.CreateBackendAuthOAuthConfig
import Amazonka.AmplifyBackend.Types.CreateBackendAuthPasswordPolicyConfig
import Amazonka.AmplifyBackend.Types.CreateBackendAuthVerificationMessageConfig
import Amazonka.AmplifyBackend.Types.RequiredSignUpAttributesElement
import Amazonka.AmplifyBackend.Types.SignInMethod
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 Amazon Cognito user pool configuration for the auth
-- resource to be configured for your Amplify project.
--
-- /See:/ 'newCreateBackendAuthUserPoolConfig' smart constructor.
data CreateBackendAuthUserPoolConfig = CreateBackendAuthUserPoolConfig'
  { -- | __(DEPRECATED)__ Describes the forgotten password policy for your Amazon
    -- Cognito user pool, configured as a part of your Amplify project.
    CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword :: Prelude.Maybe CreateBackendAuthForgotPasswordConfig,
    -- | Describes whether to apply multi-factor authentication policies for your
    -- Amazon Cognito user pool configured as a part of your Amplify project.
    CreateBackendAuthUserPoolConfig -> Maybe CreateBackendAuthMFAConfig
mfa :: Prelude.Maybe CreateBackendAuthMFAConfig,
    -- | Describes the OAuth policy and rules for your Amazon Cognito user pool,
    -- configured as a part of your Amplify project.
    CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthOAuthConfig
oAuth :: Prelude.Maybe CreateBackendAuthOAuthConfig,
    -- | Describes the password policy for your Amazon Cognito user pool,
    -- configured as a part of your Amplify project.
    CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy :: Prelude.Maybe CreateBackendAuthPasswordPolicyConfig,
    -- | Describes the email or SMS verification message for your Amazon Cognito
    -- user pool, configured as a part of your Amplify project.
    CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthVerificationMessageConfig
verificationMessage :: Prelude.Maybe CreateBackendAuthVerificationMessageConfig,
    -- | The required attributes to sign up new users in the user pool.
    CreateBackendAuthUserPoolConfig
-> [RequiredSignUpAttributesElement]
requiredSignUpAttributes :: [RequiredSignUpAttributesElement],
    -- | Describes the sign-in methods that your Amplify app users use to log in
    -- using the Amazon Cognito user pool, configured as a part of your Amplify
    -- project.
    CreateBackendAuthUserPoolConfig -> SignInMethod
signInMethod :: SignInMethod,
    -- | The Amazon Cognito user pool name.
    CreateBackendAuthUserPoolConfig -> Text
userPoolName :: Prelude.Text
  }
  deriving (CreateBackendAuthUserPoolConfig
-> CreateBackendAuthUserPoolConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackendAuthUserPoolConfig
-> CreateBackendAuthUserPoolConfig -> Bool
$c/= :: CreateBackendAuthUserPoolConfig
-> CreateBackendAuthUserPoolConfig -> Bool
== :: CreateBackendAuthUserPoolConfig
-> CreateBackendAuthUserPoolConfig -> Bool
$c== :: CreateBackendAuthUserPoolConfig
-> CreateBackendAuthUserPoolConfig -> Bool
Prelude.Eq, ReadPrec [CreateBackendAuthUserPoolConfig]
ReadPrec CreateBackendAuthUserPoolConfig
Int -> ReadS CreateBackendAuthUserPoolConfig
ReadS [CreateBackendAuthUserPoolConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackendAuthUserPoolConfig]
$creadListPrec :: ReadPrec [CreateBackendAuthUserPoolConfig]
readPrec :: ReadPrec CreateBackendAuthUserPoolConfig
$creadPrec :: ReadPrec CreateBackendAuthUserPoolConfig
readList :: ReadS [CreateBackendAuthUserPoolConfig]
$creadList :: ReadS [CreateBackendAuthUserPoolConfig]
readsPrec :: Int -> ReadS CreateBackendAuthUserPoolConfig
$creadsPrec :: Int -> ReadS CreateBackendAuthUserPoolConfig
Prelude.Read, Int -> CreateBackendAuthUserPoolConfig -> ShowS
[CreateBackendAuthUserPoolConfig] -> ShowS
CreateBackendAuthUserPoolConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackendAuthUserPoolConfig] -> ShowS
$cshowList :: [CreateBackendAuthUserPoolConfig] -> ShowS
show :: CreateBackendAuthUserPoolConfig -> String
$cshow :: CreateBackendAuthUserPoolConfig -> String
showsPrec :: Int -> CreateBackendAuthUserPoolConfig -> ShowS
$cshowsPrec :: Int -> CreateBackendAuthUserPoolConfig -> ShowS
Prelude.Show, forall x.
Rep CreateBackendAuthUserPoolConfig x
-> CreateBackendAuthUserPoolConfig
forall x.
CreateBackendAuthUserPoolConfig
-> Rep CreateBackendAuthUserPoolConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBackendAuthUserPoolConfig x
-> CreateBackendAuthUserPoolConfig
$cfrom :: forall x.
CreateBackendAuthUserPoolConfig
-> Rep CreateBackendAuthUserPoolConfig x
Prelude.Generic)

-- |
-- Create a value of 'CreateBackendAuthUserPoolConfig' 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:
--
-- 'forgotPassword', 'createBackendAuthUserPoolConfig_forgotPassword' - __(DEPRECATED)__ Describes the forgotten password policy for your Amazon
-- Cognito user pool, configured as a part of your Amplify project.
--
-- 'mfa', 'createBackendAuthUserPoolConfig_mfa' - Describes whether to apply multi-factor authentication policies for your
-- Amazon Cognito user pool configured as a part of your Amplify project.
--
-- 'oAuth', 'createBackendAuthUserPoolConfig_oAuth' - Describes the OAuth policy and rules for your Amazon Cognito user pool,
-- configured as a part of your Amplify project.
--
-- 'passwordPolicy', 'createBackendAuthUserPoolConfig_passwordPolicy' - Describes the password policy for your Amazon Cognito user pool,
-- configured as a part of your Amplify project.
--
-- 'verificationMessage', 'createBackendAuthUserPoolConfig_verificationMessage' - Describes the email or SMS verification message for your Amazon Cognito
-- user pool, configured as a part of your Amplify project.
--
-- 'requiredSignUpAttributes', 'createBackendAuthUserPoolConfig_requiredSignUpAttributes' - The required attributes to sign up new users in the user pool.
--
-- 'signInMethod', 'createBackendAuthUserPoolConfig_signInMethod' - Describes the sign-in methods that your Amplify app users use to log in
-- using the Amazon Cognito user pool, configured as a part of your Amplify
-- project.
--
-- 'userPoolName', 'createBackendAuthUserPoolConfig_userPoolName' - The Amazon Cognito user pool name.
newCreateBackendAuthUserPoolConfig ::
  -- | 'signInMethod'
  SignInMethod ->
  -- | 'userPoolName'
  Prelude.Text ->
  CreateBackendAuthUserPoolConfig
newCreateBackendAuthUserPoolConfig :: SignInMethod -> Text -> CreateBackendAuthUserPoolConfig
newCreateBackendAuthUserPoolConfig
  SignInMethod
pSignInMethod_
  Text
pUserPoolName_ =
    CreateBackendAuthUserPoolConfig'
      { $sel:forgotPassword:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword =
          forall a. Maybe a
Prelude.Nothing,
        $sel:mfa:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthMFAConfig
mfa = forall a. Maybe a
Prelude.Nothing,
        $sel:oAuth:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthOAuthConfig
oAuth = forall a. Maybe a
Prelude.Nothing,
        $sel:passwordPolicy:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy = forall a. Maybe a
Prelude.Nothing,
        $sel:verificationMessage:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthVerificationMessageConfig
verificationMessage = forall a. Maybe a
Prelude.Nothing,
        $sel:requiredSignUpAttributes:CreateBackendAuthUserPoolConfig' :: [RequiredSignUpAttributesElement]
requiredSignUpAttributes = forall a. Monoid a => a
Prelude.mempty,
        $sel:signInMethod:CreateBackendAuthUserPoolConfig' :: SignInMethod
signInMethod = SignInMethod
pSignInMethod_,
        $sel:userPoolName:CreateBackendAuthUserPoolConfig' :: Text
userPoolName = Text
pUserPoolName_
      }

-- | __(DEPRECATED)__ Describes the forgotten password policy for your Amazon
-- Cognito user pool, configured as a part of your Amplify project.
createBackendAuthUserPoolConfig_forgotPassword :: Lens.Lens' CreateBackendAuthUserPoolConfig (Prelude.Maybe CreateBackendAuthForgotPasswordConfig)
createBackendAuthUserPoolConfig_forgotPassword :: Lens'
  CreateBackendAuthUserPoolConfig
  (Maybe CreateBackendAuthForgotPasswordConfig)
createBackendAuthUserPoolConfig_forgotPassword = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword :: Maybe CreateBackendAuthForgotPasswordConfig
$sel:forgotPassword:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword} -> Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Maybe CreateBackendAuthForgotPasswordConfig
a -> CreateBackendAuthUserPoolConfig
s {$sel:forgotPassword:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword = Maybe CreateBackendAuthForgotPasswordConfig
a} :: CreateBackendAuthUserPoolConfig)

-- | Describes whether to apply multi-factor authentication policies for your
-- Amazon Cognito user pool configured as a part of your Amplify project.
createBackendAuthUserPoolConfig_mfa :: Lens.Lens' CreateBackendAuthUserPoolConfig (Prelude.Maybe CreateBackendAuthMFAConfig)
createBackendAuthUserPoolConfig_mfa :: Lens'
  CreateBackendAuthUserPoolConfig (Maybe CreateBackendAuthMFAConfig)
createBackendAuthUserPoolConfig_mfa = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Maybe CreateBackendAuthMFAConfig
mfa :: Maybe CreateBackendAuthMFAConfig
$sel:mfa:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Maybe CreateBackendAuthMFAConfig
mfa} -> Maybe CreateBackendAuthMFAConfig
mfa) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Maybe CreateBackendAuthMFAConfig
a -> CreateBackendAuthUserPoolConfig
s {$sel:mfa:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthMFAConfig
mfa = Maybe CreateBackendAuthMFAConfig
a} :: CreateBackendAuthUserPoolConfig)

-- | Describes the OAuth policy and rules for your Amazon Cognito user pool,
-- configured as a part of your Amplify project.
createBackendAuthUserPoolConfig_oAuth :: Lens.Lens' CreateBackendAuthUserPoolConfig (Prelude.Maybe CreateBackendAuthOAuthConfig)
createBackendAuthUserPoolConfig_oAuth :: Lens'
  CreateBackendAuthUserPoolConfig
  (Maybe CreateBackendAuthOAuthConfig)
createBackendAuthUserPoolConfig_oAuth = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Maybe CreateBackendAuthOAuthConfig
oAuth :: Maybe CreateBackendAuthOAuthConfig
$sel:oAuth:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthOAuthConfig
oAuth} -> Maybe CreateBackendAuthOAuthConfig
oAuth) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Maybe CreateBackendAuthOAuthConfig
a -> CreateBackendAuthUserPoolConfig
s {$sel:oAuth:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthOAuthConfig
oAuth = Maybe CreateBackendAuthOAuthConfig
a} :: CreateBackendAuthUserPoolConfig)

-- | Describes the password policy for your Amazon Cognito user pool,
-- configured as a part of your Amplify project.
createBackendAuthUserPoolConfig_passwordPolicy :: Lens.Lens' CreateBackendAuthUserPoolConfig (Prelude.Maybe CreateBackendAuthPasswordPolicyConfig)
createBackendAuthUserPoolConfig_passwordPolicy :: Lens'
  CreateBackendAuthUserPoolConfig
  (Maybe CreateBackendAuthPasswordPolicyConfig)
createBackendAuthUserPoolConfig_passwordPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy :: Maybe CreateBackendAuthPasswordPolicyConfig
$sel:passwordPolicy:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy} -> Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Maybe CreateBackendAuthPasswordPolicyConfig
a -> CreateBackendAuthUserPoolConfig
s {$sel:passwordPolicy:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy = Maybe CreateBackendAuthPasswordPolicyConfig
a} :: CreateBackendAuthUserPoolConfig)

-- | Describes the email or SMS verification message for your Amazon Cognito
-- user pool, configured as a part of your Amplify project.
createBackendAuthUserPoolConfig_verificationMessage :: Lens.Lens' CreateBackendAuthUserPoolConfig (Prelude.Maybe CreateBackendAuthVerificationMessageConfig)
createBackendAuthUserPoolConfig_verificationMessage :: Lens'
  CreateBackendAuthUserPoolConfig
  (Maybe CreateBackendAuthVerificationMessageConfig)
createBackendAuthUserPoolConfig_verificationMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Maybe CreateBackendAuthVerificationMessageConfig
verificationMessage :: Maybe CreateBackendAuthVerificationMessageConfig
$sel:verificationMessage:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthVerificationMessageConfig
verificationMessage} -> Maybe CreateBackendAuthVerificationMessageConfig
verificationMessage) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Maybe CreateBackendAuthVerificationMessageConfig
a -> CreateBackendAuthUserPoolConfig
s {$sel:verificationMessage:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthVerificationMessageConfig
verificationMessage = Maybe CreateBackendAuthVerificationMessageConfig
a} :: CreateBackendAuthUserPoolConfig)

-- | The required attributes to sign up new users in the user pool.
createBackendAuthUserPoolConfig_requiredSignUpAttributes :: Lens.Lens' CreateBackendAuthUserPoolConfig [RequiredSignUpAttributesElement]
createBackendAuthUserPoolConfig_requiredSignUpAttributes :: Lens'
  CreateBackendAuthUserPoolConfig [RequiredSignUpAttributesElement]
createBackendAuthUserPoolConfig_requiredSignUpAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {[RequiredSignUpAttributesElement]
requiredSignUpAttributes :: [RequiredSignUpAttributesElement]
$sel:requiredSignUpAttributes:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> [RequiredSignUpAttributesElement]
requiredSignUpAttributes} -> [RequiredSignUpAttributesElement]
requiredSignUpAttributes) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} [RequiredSignUpAttributesElement]
a -> CreateBackendAuthUserPoolConfig
s {$sel:requiredSignUpAttributes:CreateBackendAuthUserPoolConfig' :: [RequiredSignUpAttributesElement]
requiredSignUpAttributes = [RequiredSignUpAttributesElement]
a} :: CreateBackendAuthUserPoolConfig) 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

-- | Describes the sign-in methods that your Amplify app users use to log in
-- using the Amazon Cognito user pool, configured as a part of your Amplify
-- project.
createBackendAuthUserPoolConfig_signInMethod :: Lens.Lens' CreateBackendAuthUserPoolConfig SignInMethod
createBackendAuthUserPoolConfig_signInMethod :: Lens' CreateBackendAuthUserPoolConfig SignInMethod
createBackendAuthUserPoolConfig_signInMethod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {SignInMethod
signInMethod :: SignInMethod
$sel:signInMethod:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> SignInMethod
signInMethod} -> SignInMethod
signInMethod) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} SignInMethod
a -> CreateBackendAuthUserPoolConfig
s {$sel:signInMethod:CreateBackendAuthUserPoolConfig' :: SignInMethod
signInMethod = SignInMethod
a} :: CreateBackendAuthUserPoolConfig)

-- | The Amazon Cognito user pool name.
createBackendAuthUserPoolConfig_userPoolName :: Lens.Lens' CreateBackendAuthUserPoolConfig Prelude.Text
createBackendAuthUserPoolConfig_userPoolName :: Lens' CreateBackendAuthUserPoolConfig Text
createBackendAuthUserPoolConfig_userPoolName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Text
userPoolName :: Text
$sel:userPoolName:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Text
userPoolName} -> Text
userPoolName) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Text
a -> CreateBackendAuthUserPoolConfig
s {$sel:userPoolName:CreateBackendAuthUserPoolConfig' :: Text
userPoolName = Text
a} :: CreateBackendAuthUserPoolConfig)

instance
  Data.FromJSON
    CreateBackendAuthUserPoolConfig
  where
  parseJSON :: Value -> Parser CreateBackendAuthUserPoolConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CreateBackendAuthUserPoolConfig"
      ( \Object
x ->
          Maybe CreateBackendAuthForgotPasswordConfig
-> Maybe CreateBackendAuthMFAConfig
-> Maybe CreateBackendAuthOAuthConfig
-> Maybe CreateBackendAuthPasswordPolicyConfig
-> Maybe CreateBackendAuthVerificationMessageConfig
-> [RequiredSignUpAttributesElement]
-> SignInMethod
-> Text
-> CreateBackendAuthUserPoolConfig
CreateBackendAuthUserPoolConfig'
            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
"forgotPassword")
            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
"mfa")
            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
"oAuth")
            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
"passwordPolicy")
            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
"verificationMessage")
            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
"requiredSignUpAttributes"
                            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
"signInMethod")
            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
"userPoolName")
      )

instance
  Prelude.Hashable
    CreateBackendAuthUserPoolConfig
  where
  hashWithSalt :: Int -> CreateBackendAuthUserPoolConfig -> Int
hashWithSalt
    Int
_salt
    CreateBackendAuthUserPoolConfig' {[RequiredSignUpAttributesElement]
Maybe CreateBackendAuthPasswordPolicyConfig
Maybe CreateBackendAuthMFAConfig
Maybe CreateBackendAuthVerificationMessageConfig
Maybe CreateBackendAuthForgotPasswordConfig
Maybe CreateBackendAuthOAuthConfig
Text
SignInMethod
userPoolName :: Text
signInMethod :: SignInMethod
requiredSignUpAttributes :: [RequiredSignUpAttributesElement]
verificationMessage :: Maybe CreateBackendAuthVerificationMessageConfig
passwordPolicy :: Maybe CreateBackendAuthPasswordPolicyConfig
oAuth :: Maybe CreateBackendAuthOAuthConfig
mfa :: Maybe CreateBackendAuthMFAConfig
forgotPassword :: Maybe CreateBackendAuthForgotPasswordConfig
$sel:userPoolName:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Text
$sel:signInMethod:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> SignInMethod
$sel:requiredSignUpAttributes:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> [RequiredSignUpAttributesElement]
$sel:verificationMessage:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthVerificationMessageConfig
$sel:passwordPolicy:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthPasswordPolicyConfig
$sel:oAuth:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthOAuthConfig
$sel:mfa:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Maybe CreateBackendAuthMFAConfig
$sel:forgotPassword:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthForgotPasswordConfig
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CreateBackendAuthMFAConfig
mfa
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CreateBackendAuthOAuthConfig
oAuth
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CreateBackendAuthVerificationMessageConfig
verificationMessage
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [RequiredSignUpAttributesElement]
requiredSignUpAttributes
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SignInMethod
signInMethod
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userPoolName

instance
  Prelude.NFData
    CreateBackendAuthUserPoolConfig
  where
  rnf :: CreateBackendAuthUserPoolConfig -> ()
rnf CreateBackendAuthUserPoolConfig' {[RequiredSignUpAttributesElement]
Maybe CreateBackendAuthPasswordPolicyConfig
Maybe CreateBackendAuthMFAConfig
Maybe CreateBackendAuthVerificationMessageConfig
Maybe CreateBackendAuthForgotPasswordConfig
Maybe CreateBackendAuthOAuthConfig
Text
SignInMethod
userPoolName :: Text
signInMethod :: SignInMethod
requiredSignUpAttributes :: [RequiredSignUpAttributesElement]
verificationMessage :: Maybe CreateBackendAuthVerificationMessageConfig
passwordPolicy :: Maybe CreateBackendAuthPasswordPolicyConfig
oAuth :: Maybe CreateBackendAuthOAuthConfig
mfa :: Maybe CreateBackendAuthMFAConfig
forgotPassword :: Maybe CreateBackendAuthForgotPasswordConfig
$sel:userPoolName:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Text
$sel:signInMethod:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> SignInMethod
$sel:requiredSignUpAttributes:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> [RequiredSignUpAttributesElement]
$sel:verificationMessage:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthVerificationMessageConfig
$sel:passwordPolicy:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthPasswordPolicyConfig
$sel:oAuth:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthOAuthConfig
$sel:mfa:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Maybe CreateBackendAuthMFAConfig
$sel:forgotPassword:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthForgotPasswordConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CreateBackendAuthMFAConfig
mfa
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CreateBackendAuthOAuthConfig
oAuth
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CreateBackendAuthVerificationMessageConfig
verificationMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [RequiredSignUpAttributesElement]
requiredSignUpAttributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SignInMethod
signInMethod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userPoolName

instance Data.ToJSON CreateBackendAuthUserPoolConfig where
  toJSON :: CreateBackendAuthUserPoolConfig -> Value
toJSON CreateBackendAuthUserPoolConfig' {[RequiredSignUpAttributesElement]
Maybe CreateBackendAuthPasswordPolicyConfig
Maybe CreateBackendAuthMFAConfig
Maybe CreateBackendAuthVerificationMessageConfig
Maybe CreateBackendAuthForgotPasswordConfig
Maybe CreateBackendAuthOAuthConfig
Text
SignInMethod
userPoolName :: Text
signInMethod :: SignInMethod
requiredSignUpAttributes :: [RequiredSignUpAttributesElement]
verificationMessage :: Maybe CreateBackendAuthVerificationMessageConfig
passwordPolicy :: Maybe CreateBackendAuthPasswordPolicyConfig
oAuth :: Maybe CreateBackendAuthOAuthConfig
mfa :: Maybe CreateBackendAuthMFAConfig
forgotPassword :: Maybe CreateBackendAuthForgotPasswordConfig
$sel:userPoolName:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Text
$sel:signInMethod:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> SignInMethod
$sel:requiredSignUpAttributes:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> [RequiredSignUpAttributesElement]
$sel:verificationMessage:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthVerificationMessageConfig
$sel:passwordPolicy:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthPasswordPolicyConfig
$sel:oAuth:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthOAuthConfig
$sel:mfa:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Maybe CreateBackendAuthMFAConfig
$sel:forgotPassword:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthForgotPasswordConfig
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"forgotPassword" 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 CreateBackendAuthForgotPasswordConfig
forgotPassword,
            (Key
"mfa" 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 CreateBackendAuthMFAConfig
mfa,
            (Key
"oAuth" 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 CreateBackendAuthOAuthConfig
oAuth,
            (Key
"passwordPolicy" 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 CreateBackendAuthPasswordPolicyConfig
passwordPolicy,
            (Key
"verificationMessage" 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 CreateBackendAuthVerificationMessageConfig
verificationMessage,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"requiredSignUpAttributes"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [RequiredSignUpAttributesElement]
requiredSignUpAttributes
              ),
            forall a. a -> Maybe a
Prelude.Just (Key
"signInMethod" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SignInMethod
signInMethod),
            forall a. a -> Maybe a
Prelude.Just (Key
"userPoolName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
userPoolName)
          ]
      )