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

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 type used for enabling software token MFA at the user pool level.
--
-- /See:/ 'newSoftwareTokenMfaConfigType' smart constructor.
data SoftwareTokenMfaConfigType = SoftwareTokenMfaConfigType'
  { -- | Specifies whether software token MFA is activated.
    SoftwareTokenMfaConfigType -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (SoftwareTokenMfaConfigType -> SoftwareTokenMfaConfigType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SoftwareTokenMfaConfigType -> SoftwareTokenMfaConfigType -> Bool
$c/= :: SoftwareTokenMfaConfigType -> SoftwareTokenMfaConfigType -> Bool
== :: SoftwareTokenMfaConfigType -> SoftwareTokenMfaConfigType -> Bool
$c== :: SoftwareTokenMfaConfigType -> SoftwareTokenMfaConfigType -> Bool
Prelude.Eq, ReadPrec [SoftwareTokenMfaConfigType]
ReadPrec SoftwareTokenMfaConfigType
Int -> ReadS SoftwareTokenMfaConfigType
ReadS [SoftwareTokenMfaConfigType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SoftwareTokenMfaConfigType]
$creadListPrec :: ReadPrec [SoftwareTokenMfaConfigType]
readPrec :: ReadPrec SoftwareTokenMfaConfigType
$creadPrec :: ReadPrec SoftwareTokenMfaConfigType
readList :: ReadS [SoftwareTokenMfaConfigType]
$creadList :: ReadS [SoftwareTokenMfaConfigType]
readsPrec :: Int -> ReadS SoftwareTokenMfaConfigType
$creadsPrec :: Int -> ReadS SoftwareTokenMfaConfigType
Prelude.Read, Int -> SoftwareTokenMfaConfigType -> ShowS
[SoftwareTokenMfaConfigType] -> ShowS
SoftwareTokenMfaConfigType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SoftwareTokenMfaConfigType] -> ShowS
$cshowList :: [SoftwareTokenMfaConfigType] -> ShowS
show :: SoftwareTokenMfaConfigType -> String
$cshow :: SoftwareTokenMfaConfigType -> String
showsPrec :: Int -> SoftwareTokenMfaConfigType -> ShowS
$cshowsPrec :: Int -> SoftwareTokenMfaConfigType -> ShowS
Prelude.Show, forall x.
Rep SoftwareTokenMfaConfigType x -> SoftwareTokenMfaConfigType
forall x.
SoftwareTokenMfaConfigType -> Rep SoftwareTokenMfaConfigType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SoftwareTokenMfaConfigType x -> SoftwareTokenMfaConfigType
$cfrom :: forall x.
SoftwareTokenMfaConfigType -> Rep SoftwareTokenMfaConfigType x
Prelude.Generic)

-- |
-- Create a value of 'SoftwareTokenMfaConfigType' 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:
--
-- 'enabled', 'softwareTokenMfaConfigType_enabled' - Specifies whether software token MFA is activated.
newSoftwareTokenMfaConfigType ::
  SoftwareTokenMfaConfigType
newSoftwareTokenMfaConfigType :: SoftwareTokenMfaConfigType
newSoftwareTokenMfaConfigType =
  SoftwareTokenMfaConfigType'
    { $sel:enabled:SoftwareTokenMfaConfigType' :: Maybe Bool
enabled =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether software token MFA is activated.
softwareTokenMfaConfigType_enabled :: Lens.Lens' SoftwareTokenMfaConfigType (Prelude.Maybe Prelude.Bool)
softwareTokenMfaConfigType_enabled :: Lens' SoftwareTokenMfaConfigType (Maybe Bool)
softwareTokenMfaConfigType_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SoftwareTokenMfaConfigType' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:SoftwareTokenMfaConfigType' :: SoftwareTokenMfaConfigType -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: SoftwareTokenMfaConfigType
s@SoftwareTokenMfaConfigType' {} Maybe Bool
a -> SoftwareTokenMfaConfigType
s {$sel:enabled:SoftwareTokenMfaConfigType' :: Maybe Bool
enabled = Maybe Bool
a} :: SoftwareTokenMfaConfigType)

instance Data.FromJSON SoftwareTokenMfaConfigType where
  parseJSON :: Value -> Parser SoftwareTokenMfaConfigType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SoftwareTokenMfaConfigType"
      ( \Object
x ->
          Maybe Bool -> SoftwareTokenMfaConfigType
SoftwareTokenMfaConfigType'
            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
"Enabled")
      )

instance Prelude.Hashable SoftwareTokenMfaConfigType where
  hashWithSalt :: Int -> SoftwareTokenMfaConfigType -> Int
hashWithSalt Int
_salt SoftwareTokenMfaConfigType' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:SoftwareTokenMfaConfigType' :: SoftwareTokenMfaConfigType -> Maybe Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled

instance Prelude.NFData SoftwareTokenMfaConfigType where
  rnf :: SoftwareTokenMfaConfigType -> ()
rnf SoftwareTokenMfaConfigType' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:SoftwareTokenMfaConfigType' :: SoftwareTokenMfaConfigType -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled

instance Data.ToJSON SoftwareTokenMfaConfigType where
  toJSON :: SoftwareTokenMfaConfigType -> Value
toJSON SoftwareTokenMfaConfigType' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:SoftwareTokenMfaConfigType' :: SoftwareTokenMfaConfigType -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Enabled" 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
enabled]
      )