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

import Amazonka.CognitoIdentityProvider.Types.SmsConfigurationType
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

-- | The SMS text message multi-factor authentication (MFA) configuration
-- type.
--
-- /See:/ 'newSmsMfaConfigType' smart constructor.
data SmsMfaConfigType = SmsMfaConfigType'
  { -- | The SMS authentication message that will be sent to users with the code
    -- they must sign in. The message must contain the ‘{####}’ placeholder,
    -- which is replaced with the code. If the message isn\'t included, and
    -- default message will be used.
    SmsMfaConfigType -> Maybe Text
smsAuthenticationMessage :: Prelude.Maybe Prelude.Text,
    -- | The SMS configuration with the settings that your Amazon Cognito user
    -- pool must use to send an SMS message from your Amazon Web Services
    -- account through Amazon Simple Notification Service. To request Amazon
    -- SNS in the Amazon Web Services Region that you want, the Amazon Cognito
    -- user pool uses an Identity and Access Management (IAM) role that you
    -- provide for your Amazon Web Services account.
    SmsMfaConfigType -> Maybe SmsConfigurationType
smsConfiguration :: Prelude.Maybe SmsConfigurationType
  }
  deriving (SmsMfaConfigType -> SmsMfaConfigType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SmsMfaConfigType -> SmsMfaConfigType -> Bool
$c/= :: SmsMfaConfigType -> SmsMfaConfigType -> Bool
== :: SmsMfaConfigType -> SmsMfaConfigType -> Bool
$c== :: SmsMfaConfigType -> SmsMfaConfigType -> Bool
Prelude.Eq, ReadPrec [SmsMfaConfigType]
ReadPrec SmsMfaConfigType
Int -> ReadS SmsMfaConfigType
ReadS [SmsMfaConfigType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SmsMfaConfigType]
$creadListPrec :: ReadPrec [SmsMfaConfigType]
readPrec :: ReadPrec SmsMfaConfigType
$creadPrec :: ReadPrec SmsMfaConfigType
readList :: ReadS [SmsMfaConfigType]
$creadList :: ReadS [SmsMfaConfigType]
readsPrec :: Int -> ReadS SmsMfaConfigType
$creadsPrec :: Int -> ReadS SmsMfaConfigType
Prelude.Read, Int -> SmsMfaConfigType -> ShowS
[SmsMfaConfigType] -> ShowS
SmsMfaConfigType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SmsMfaConfigType] -> ShowS
$cshowList :: [SmsMfaConfigType] -> ShowS
show :: SmsMfaConfigType -> String
$cshow :: SmsMfaConfigType -> String
showsPrec :: Int -> SmsMfaConfigType -> ShowS
$cshowsPrec :: Int -> SmsMfaConfigType -> ShowS
Prelude.Show, forall x. Rep SmsMfaConfigType x -> SmsMfaConfigType
forall x. SmsMfaConfigType -> Rep SmsMfaConfigType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SmsMfaConfigType x -> SmsMfaConfigType
$cfrom :: forall x. SmsMfaConfigType -> Rep SmsMfaConfigType x
Prelude.Generic)

-- |
-- Create a value of 'SmsMfaConfigType' 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:
--
-- 'smsAuthenticationMessage', 'smsMfaConfigType_smsAuthenticationMessage' - The SMS authentication message that will be sent to users with the code
-- they must sign in. The message must contain the ‘{####}’ placeholder,
-- which is replaced with the code. If the message isn\'t included, and
-- default message will be used.
--
-- 'smsConfiguration', 'smsMfaConfigType_smsConfiguration' - The SMS configuration with the settings that your Amazon Cognito user
-- pool must use to send an SMS message from your Amazon Web Services
-- account through Amazon Simple Notification Service. To request Amazon
-- SNS in the Amazon Web Services Region that you want, the Amazon Cognito
-- user pool uses an Identity and Access Management (IAM) role that you
-- provide for your Amazon Web Services account.
newSmsMfaConfigType ::
  SmsMfaConfigType
newSmsMfaConfigType :: SmsMfaConfigType
newSmsMfaConfigType =
  SmsMfaConfigType'
    { $sel:smsAuthenticationMessage:SmsMfaConfigType' :: Maybe Text
smsAuthenticationMessage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:smsConfiguration:SmsMfaConfigType' :: Maybe SmsConfigurationType
smsConfiguration = forall a. Maybe a
Prelude.Nothing
    }

-- | The SMS authentication message that will be sent to users with the code
-- they must sign in. The message must contain the ‘{####}’ placeholder,
-- which is replaced with the code. If the message isn\'t included, and
-- default message will be used.
smsMfaConfigType_smsAuthenticationMessage :: Lens.Lens' SmsMfaConfigType (Prelude.Maybe Prelude.Text)
smsMfaConfigType_smsAuthenticationMessage :: Lens' SmsMfaConfigType (Maybe Text)
smsMfaConfigType_smsAuthenticationMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SmsMfaConfigType' {Maybe Text
smsAuthenticationMessage :: Maybe Text
$sel:smsAuthenticationMessage:SmsMfaConfigType' :: SmsMfaConfigType -> Maybe Text
smsAuthenticationMessage} -> Maybe Text
smsAuthenticationMessage) (\s :: SmsMfaConfigType
s@SmsMfaConfigType' {} Maybe Text
a -> SmsMfaConfigType
s {$sel:smsAuthenticationMessage:SmsMfaConfigType' :: Maybe Text
smsAuthenticationMessage = Maybe Text
a} :: SmsMfaConfigType)

-- | The SMS configuration with the settings that your Amazon Cognito user
-- pool must use to send an SMS message from your Amazon Web Services
-- account through Amazon Simple Notification Service. To request Amazon
-- SNS in the Amazon Web Services Region that you want, the Amazon Cognito
-- user pool uses an Identity and Access Management (IAM) role that you
-- provide for your Amazon Web Services account.
smsMfaConfigType_smsConfiguration :: Lens.Lens' SmsMfaConfigType (Prelude.Maybe SmsConfigurationType)
smsMfaConfigType_smsConfiguration :: Lens' SmsMfaConfigType (Maybe SmsConfigurationType)
smsMfaConfigType_smsConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SmsMfaConfigType' {Maybe SmsConfigurationType
smsConfiguration :: Maybe SmsConfigurationType
$sel:smsConfiguration:SmsMfaConfigType' :: SmsMfaConfigType -> Maybe SmsConfigurationType
smsConfiguration} -> Maybe SmsConfigurationType
smsConfiguration) (\s :: SmsMfaConfigType
s@SmsMfaConfigType' {} Maybe SmsConfigurationType
a -> SmsMfaConfigType
s {$sel:smsConfiguration:SmsMfaConfigType' :: Maybe SmsConfigurationType
smsConfiguration = Maybe SmsConfigurationType
a} :: SmsMfaConfigType)

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

instance Prelude.Hashable SmsMfaConfigType where
  hashWithSalt :: Int -> SmsMfaConfigType -> Int
hashWithSalt Int
_salt SmsMfaConfigType' {Maybe Text
Maybe SmsConfigurationType
smsConfiguration :: Maybe SmsConfigurationType
smsAuthenticationMessage :: Maybe Text
$sel:smsConfiguration:SmsMfaConfigType' :: SmsMfaConfigType -> Maybe SmsConfigurationType
$sel:smsAuthenticationMessage:SmsMfaConfigType' :: SmsMfaConfigType -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
smsAuthenticationMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SmsConfigurationType
smsConfiguration

instance Prelude.NFData SmsMfaConfigType where
  rnf :: SmsMfaConfigType -> ()
rnf SmsMfaConfigType' {Maybe Text
Maybe SmsConfigurationType
smsConfiguration :: Maybe SmsConfigurationType
smsAuthenticationMessage :: Maybe Text
$sel:smsConfiguration:SmsMfaConfigType' :: SmsMfaConfigType -> Maybe SmsConfigurationType
$sel:smsAuthenticationMessage:SmsMfaConfigType' :: SmsMfaConfigType -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
smsAuthenticationMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SmsConfigurationType
smsConfiguration

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