{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CognitoIdentityProvider.Types.SoftwareTokenMfaConfigType where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 enabled.
    SoftwareTokenMfaConfigType -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (SoftwareTokenMfaConfigType -> SoftwareTokenMfaConfigType -> Bool
(SoftwareTokenMfaConfigType -> SoftwareTokenMfaConfigType -> Bool)
-> (SoftwareTokenMfaConfigType
    -> SoftwareTokenMfaConfigType -> Bool)
-> Eq SoftwareTokenMfaConfigType
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]
(Int -> ReadS SoftwareTokenMfaConfigType)
-> ReadS [SoftwareTokenMfaConfigType]
-> ReadPrec SoftwareTokenMfaConfigType
-> ReadPrec [SoftwareTokenMfaConfigType]
-> Read 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
(Int -> SoftwareTokenMfaConfigType -> ShowS)
-> (SoftwareTokenMfaConfigType -> String)
-> ([SoftwareTokenMfaConfigType] -> ShowS)
-> Show SoftwareTokenMfaConfigType
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.
 SoftwareTokenMfaConfigType -> Rep SoftwareTokenMfaConfigType x)
-> (forall x.
    Rep SoftwareTokenMfaConfigType x -> SoftwareTokenMfaConfigType)
-> Generic SoftwareTokenMfaConfigType
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 enabled.
newSoftwareTokenMfaConfigType ::
  SoftwareTokenMfaConfigType
newSoftwareTokenMfaConfigType :: SoftwareTokenMfaConfigType
newSoftwareTokenMfaConfigType =
  SoftwareTokenMfaConfigType' :: Maybe Bool -> SoftwareTokenMfaConfigType
SoftwareTokenMfaConfigType'
    { $sel:enabled:SoftwareTokenMfaConfigType' :: Maybe Bool
enabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether software token MFA is enabled.
softwareTokenMfaConfigType_enabled :: Lens.Lens' SoftwareTokenMfaConfigType (Prelude.Maybe Prelude.Bool)
softwareTokenMfaConfigType_enabled :: (Maybe Bool -> f (Maybe Bool))
-> SoftwareTokenMfaConfigType -> f SoftwareTokenMfaConfigType
softwareTokenMfaConfigType_enabled = (SoftwareTokenMfaConfigType -> Maybe Bool)
-> (SoftwareTokenMfaConfigType
    -> Maybe Bool -> SoftwareTokenMfaConfigType)
-> Lens
     SoftwareTokenMfaConfigType
     SoftwareTokenMfaConfigType
     (Maybe Bool)
     (Maybe Bool)
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 Core.FromJSON SoftwareTokenMfaConfigType where
  parseJSON :: Value -> Parser SoftwareTokenMfaConfigType
parseJSON =
    String
-> (Object -> Parser SoftwareTokenMfaConfigType)
-> Value
-> Parser SoftwareTokenMfaConfigType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SoftwareTokenMfaConfigType"
      ( \Object
x ->
          Maybe Bool -> SoftwareTokenMfaConfigType
SoftwareTokenMfaConfigType'
            (Maybe Bool -> SoftwareTokenMfaConfigType)
-> Parser (Maybe Bool) -> Parser SoftwareTokenMfaConfigType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Enabled")
      )

instance Prelude.Hashable SoftwareTokenMfaConfigType

instance Prelude.NFData SoftwareTokenMfaConfigType

instance Core.ToJSON SoftwareTokenMfaConfigType where
  toJSON :: SoftwareTokenMfaConfigType -> Value
toJSON SoftwareTokenMfaConfigType' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:SoftwareTokenMfaConfigType' :: SoftwareTokenMfaConfigType -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled]
      )