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

import Amazonka.AmplifyBackend.Types.DeliveryMethod
import Amazonka.AmplifyBackend.Types.EmailSettings
import Amazonka.AmplifyBackend.Types.SmsSettings
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

-- | __(DEPRECATED)__ Describes the forgot password policy for authenticating
-- into the Amplify app.
--
-- /See:/ 'newUpdateBackendAuthForgotPasswordConfig' smart constructor.
data UpdateBackendAuthForgotPasswordConfig = UpdateBackendAuthForgotPasswordConfig'
  { -- | __(DEPRECATED)__ Describes which mode to use (either SMS or email) to
    -- deliver messages to app users that want to recover their password.
    UpdateBackendAuthForgotPasswordConfig -> Maybe DeliveryMethod
deliveryMethod :: Prelude.Maybe DeliveryMethod,
    -- | __(DEPRECATED)__ The configuration for the email sent when an app user
    -- forgets their password.
    UpdateBackendAuthForgotPasswordConfig -> Maybe EmailSettings
emailSettings :: Prelude.Maybe EmailSettings,
    -- | __(DEPRECATED)__ The configuration for the SMS message sent when an
    -- Amplify app user forgets their password.
    UpdateBackendAuthForgotPasswordConfig -> Maybe SmsSettings
smsSettings :: Prelude.Maybe SmsSettings
  }
  deriving (UpdateBackendAuthForgotPasswordConfig
-> UpdateBackendAuthForgotPasswordConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBackendAuthForgotPasswordConfig
-> UpdateBackendAuthForgotPasswordConfig -> Bool
$c/= :: UpdateBackendAuthForgotPasswordConfig
-> UpdateBackendAuthForgotPasswordConfig -> Bool
== :: UpdateBackendAuthForgotPasswordConfig
-> UpdateBackendAuthForgotPasswordConfig -> Bool
$c== :: UpdateBackendAuthForgotPasswordConfig
-> UpdateBackendAuthForgotPasswordConfig -> Bool
Prelude.Eq, ReadPrec [UpdateBackendAuthForgotPasswordConfig]
ReadPrec UpdateBackendAuthForgotPasswordConfig
Int -> ReadS UpdateBackendAuthForgotPasswordConfig
ReadS [UpdateBackendAuthForgotPasswordConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBackendAuthForgotPasswordConfig]
$creadListPrec :: ReadPrec [UpdateBackendAuthForgotPasswordConfig]
readPrec :: ReadPrec UpdateBackendAuthForgotPasswordConfig
$creadPrec :: ReadPrec UpdateBackendAuthForgotPasswordConfig
readList :: ReadS [UpdateBackendAuthForgotPasswordConfig]
$creadList :: ReadS [UpdateBackendAuthForgotPasswordConfig]
readsPrec :: Int -> ReadS UpdateBackendAuthForgotPasswordConfig
$creadsPrec :: Int -> ReadS UpdateBackendAuthForgotPasswordConfig
Prelude.Read, Int -> UpdateBackendAuthForgotPasswordConfig -> ShowS
[UpdateBackendAuthForgotPasswordConfig] -> ShowS
UpdateBackendAuthForgotPasswordConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBackendAuthForgotPasswordConfig] -> ShowS
$cshowList :: [UpdateBackendAuthForgotPasswordConfig] -> ShowS
show :: UpdateBackendAuthForgotPasswordConfig -> String
$cshow :: UpdateBackendAuthForgotPasswordConfig -> String
showsPrec :: Int -> UpdateBackendAuthForgotPasswordConfig -> ShowS
$cshowsPrec :: Int -> UpdateBackendAuthForgotPasswordConfig -> ShowS
Prelude.Show, forall x.
Rep UpdateBackendAuthForgotPasswordConfig x
-> UpdateBackendAuthForgotPasswordConfig
forall x.
UpdateBackendAuthForgotPasswordConfig
-> Rep UpdateBackendAuthForgotPasswordConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateBackendAuthForgotPasswordConfig x
-> UpdateBackendAuthForgotPasswordConfig
$cfrom :: forall x.
UpdateBackendAuthForgotPasswordConfig
-> Rep UpdateBackendAuthForgotPasswordConfig x
Prelude.Generic)

-- |
-- Create a value of 'UpdateBackendAuthForgotPasswordConfig' 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:
--
-- 'deliveryMethod', 'updateBackendAuthForgotPasswordConfig_deliveryMethod' - __(DEPRECATED)__ Describes which mode to use (either SMS or email) to
-- deliver messages to app users that want to recover their password.
--
-- 'emailSettings', 'updateBackendAuthForgotPasswordConfig_emailSettings' - __(DEPRECATED)__ The configuration for the email sent when an app user
-- forgets their password.
--
-- 'smsSettings', 'updateBackendAuthForgotPasswordConfig_smsSettings' - __(DEPRECATED)__ The configuration for the SMS message sent when an
-- Amplify app user forgets their password.
newUpdateBackendAuthForgotPasswordConfig ::
  UpdateBackendAuthForgotPasswordConfig
newUpdateBackendAuthForgotPasswordConfig :: UpdateBackendAuthForgotPasswordConfig
newUpdateBackendAuthForgotPasswordConfig =
  UpdateBackendAuthForgotPasswordConfig'
    { $sel:deliveryMethod:UpdateBackendAuthForgotPasswordConfig' :: Maybe DeliveryMethod
deliveryMethod =
        forall a. Maybe a
Prelude.Nothing,
      $sel:emailSettings:UpdateBackendAuthForgotPasswordConfig' :: Maybe EmailSettings
emailSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:smsSettings:UpdateBackendAuthForgotPasswordConfig' :: Maybe SmsSettings
smsSettings = forall a. Maybe a
Prelude.Nothing
    }

-- | __(DEPRECATED)__ Describes which mode to use (either SMS or email) to
-- deliver messages to app users that want to recover their password.
updateBackendAuthForgotPasswordConfig_deliveryMethod :: Lens.Lens' UpdateBackendAuthForgotPasswordConfig (Prelude.Maybe DeliveryMethod)
updateBackendAuthForgotPasswordConfig_deliveryMethod :: Lens' UpdateBackendAuthForgotPasswordConfig (Maybe DeliveryMethod)
updateBackendAuthForgotPasswordConfig_deliveryMethod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBackendAuthForgotPasswordConfig' {Maybe DeliveryMethod
deliveryMethod :: Maybe DeliveryMethod
$sel:deliveryMethod:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe DeliveryMethod
deliveryMethod} -> Maybe DeliveryMethod
deliveryMethod) (\s :: UpdateBackendAuthForgotPasswordConfig
s@UpdateBackendAuthForgotPasswordConfig' {} Maybe DeliveryMethod
a -> UpdateBackendAuthForgotPasswordConfig
s {$sel:deliveryMethod:UpdateBackendAuthForgotPasswordConfig' :: Maybe DeliveryMethod
deliveryMethod = Maybe DeliveryMethod
a} :: UpdateBackendAuthForgotPasswordConfig)

-- | __(DEPRECATED)__ The configuration for the email sent when an app user
-- forgets their password.
updateBackendAuthForgotPasswordConfig_emailSettings :: Lens.Lens' UpdateBackendAuthForgotPasswordConfig (Prelude.Maybe EmailSettings)
updateBackendAuthForgotPasswordConfig_emailSettings :: Lens' UpdateBackendAuthForgotPasswordConfig (Maybe EmailSettings)
updateBackendAuthForgotPasswordConfig_emailSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBackendAuthForgotPasswordConfig' {Maybe EmailSettings
emailSettings :: Maybe EmailSettings
$sel:emailSettings:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe EmailSettings
emailSettings} -> Maybe EmailSettings
emailSettings) (\s :: UpdateBackendAuthForgotPasswordConfig
s@UpdateBackendAuthForgotPasswordConfig' {} Maybe EmailSettings
a -> UpdateBackendAuthForgotPasswordConfig
s {$sel:emailSettings:UpdateBackendAuthForgotPasswordConfig' :: Maybe EmailSettings
emailSettings = Maybe EmailSettings
a} :: UpdateBackendAuthForgotPasswordConfig)

-- | __(DEPRECATED)__ The configuration for the SMS message sent when an
-- Amplify app user forgets their password.
updateBackendAuthForgotPasswordConfig_smsSettings :: Lens.Lens' UpdateBackendAuthForgotPasswordConfig (Prelude.Maybe SmsSettings)
updateBackendAuthForgotPasswordConfig_smsSettings :: Lens' UpdateBackendAuthForgotPasswordConfig (Maybe SmsSettings)
updateBackendAuthForgotPasswordConfig_smsSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBackendAuthForgotPasswordConfig' {Maybe SmsSettings
smsSettings :: Maybe SmsSettings
$sel:smsSettings:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe SmsSettings
smsSettings} -> Maybe SmsSettings
smsSettings) (\s :: UpdateBackendAuthForgotPasswordConfig
s@UpdateBackendAuthForgotPasswordConfig' {} Maybe SmsSettings
a -> UpdateBackendAuthForgotPasswordConfig
s {$sel:smsSettings:UpdateBackendAuthForgotPasswordConfig' :: Maybe SmsSettings
smsSettings = Maybe SmsSettings
a} :: UpdateBackendAuthForgotPasswordConfig)

instance
  Prelude.Hashable
    UpdateBackendAuthForgotPasswordConfig
  where
  hashWithSalt :: Int -> UpdateBackendAuthForgotPasswordConfig -> Int
hashWithSalt
    Int
_salt
    UpdateBackendAuthForgotPasswordConfig' {Maybe DeliveryMethod
Maybe EmailSettings
Maybe SmsSettings
smsSettings :: Maybe SmsSettings
emailSettings :: Maybe EmailSettings
deliveryMethod :: Maybe DeliveryMethod
$sel:smsSettings:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe SmsSettings
$sel:emailSettings:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe EmailSettings
$sel:deliveryMethod:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe DeliveryMethod
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeliveryMethod
deliveryMethod
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EmailSettings
emailSettings
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SmsSettings
smsSettings

instance
  Prelude.NFData
    UpdateBackendAuthForgotPasswordConfig
  where
  rnf :: UpdateBackendAuthForgotPasswordConfig -> ()
rnf UpdateBackendAuthForgotPasswordConfig' {Maybe DeliveryMethod
Maybe EmailSettings
Maybe SmsSettings
smsSettings :: Maybe SmsSettings
emailSettings :: Maybe EmailSettings
deliveryMethod :: Maybe DeliveryMethod
$sel:smsSettings:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe SmsSettings
$sel:emailSettings:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe EmailSettings
$sel:deliveryMethod:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe DeliveryMethod
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DeliveryMethod
deliveryMethod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EmailSettings
emailSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SmsSettings
smsSettings

instance
  Data.ToJSON
    UpdateBackendAuthForgotPasswordConfig
  where
  toJSON :: UpdateBackendAuthForgotPasswordConfig -> Value
toJSON UpdateBackendAuthForgotPasswordConfig' {Maybe DeliveryMethod
Maybe EmailSettings
Maybe SmsSettings
smsSettings :: Maybe SmsSettings
emailSettings :: Maybe EmailSettings
deliveryMethod :: Maybe DeliveryMethod
$sel:smsSettings:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe SmsSettings
$sel:emailSettings:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe EmailSettings
$sel:deliveryMethod:UpdateBackendAuthForgotPasswordConfig' :: UpdateBackendAuthForgotPasswordConfig -> Maybe DeliveryMethod
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"deliveryMethod" 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 DeliveryMethod
deliveryMethod,
            (Key
"emailSettings" 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 EmailSettings
emailSettings,
            (Key
"smsSettings" 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 SmsSettings
smsSettings
          ]
      )