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

import Amazonka.CognitoIdentityProvider.Types.DeliveryMediumType
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 delivery details for an email or SMS message that Amazon Cognito
-- sent for authentication or verification.
--
-- /See:/ 'newCodeDeliveryDetailsType' smart constructor.
data CodeDeliveryDetailsType = CodeDeliveryDetailsType'
  { -- | The name of the attribute that Amazon Cognito verifies with the code.
    CodeDeliveryDetailsType -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
    -- | The method that Amazon Cognito used to send the code.
    CodeDeliveryDetailsType -> Maybe DeliveryMediumType
deliveryMedium :: Prelude.Maybe DeliveryMediumType,
    -- | The email address or phone number destination where Amazon Cognito sent
    -- the code.
    CodeDeliveryDetailsType -> Maybe Text
destination :: Prelude.Maybe Prelude.Text
  }
  deriving (CodeDeliveryDetailsType -> CodeDeliveryDetailsType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeDeliveryDetailsType -> CodeDeliveryDetailsType -> Bool
$c/= :: CodeDeliveryDetailsType -> CodeDeliveryDetailsType -> Bool
== :: CodeDeliveryDetailsType -> CodeDeliveryDetailsType -> Bool
$c== :: CodeDeliveryDetailsType -> CodeDeliveryDetailsType -> Bool
Prelude.Eq, ReadPrec [CodeDeliveryDetailsType]
ReadPrec CodeDeliveryDetailsType
Int -> ReadS CodeDeliveryDetailsType
ReadS [CodeDeliveryDetailsType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeDeliveryDetailsType]
$creadListPrec :: ReadPrec [CodeDeliveryDetailsType]
readPrec :: ReadPrec CodeDeliveryDetailsType
$creadPrec :: ReadPrec CodeDeliveryDetailsType
readList :: ReadS [CodeDeliveryDetailsType]
$creadList :: ReadS [CodeDeliveryDetailsType]
readsPrec :: Int -> ReadS CodeDeliveryDetailsType
$creadsPrec :: Int -> ReadS CodeDeliveryDetailsType
Prelude.Read, Int -> CodeDeliveryDetailsType -> ShowS
[CodeDeliveryDetailsType] -> ShowS
CodeDeliveryDetailsType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeDeliveryDetailsType] -> ShowS
$cshowList :: [CodeDeliveryDetailsType] -> ShowS
show :: CodeDeliveryDetailsType -> String
$cshow :: CodeDeliveryDetailsType -> String
showsPrec :: Int -> CodeDeliveryDetailsType -> ShowS
$cshowsPrec :: Int -> CodeDeliveryDetailsType -> ShowS
Prelude.Show, forall x. Rep CodeDeliveryDetailsType x -> CodeDeliveryDetailsType
forall x. CodeDeliveryDetailsType -> Rep CodeDeliveryDetailsType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeDeliveryDetailsType x -> CodeDeliveryDetailsType
$cfrom :: forall x. CodeDeliveryDetailsType -> Rep CodeDeliveryDetailsType x
Prelude.Generic)

-- |
-- Create a value of 'CodeDeliveryDetailsType' 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:
--
-- 'attributeName', 'codeDeliveryDetailsType_attributeName' - The name of the attribute that Amazon Cognito verifies with the code.
--
-- 'deliveryMedium', 'codeDeliveryDetailsType_deliveryMedium' - The method that Amazon Cognito used to send the code.
--
-- 'destination', 'codeDeliveryDetailsType_destination' - The email address or phone number destination where Amazon Cognito sent
-- the code.
newCodeDeliveryDetailsType ::
  CodeDeliveryDetailsType
newCodeDeliveryDetailsType :: CodeDeliveryDetailsType
newCodeDeliveryDetailsType =
  CodeDeliveryDetailsType'
    { $sel:attributeName:CodeDeliveryDetailsType' :: Maybe Text
attributeName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:deliveryMedium:CodeDeliveryDetailsType' :: Maybe DeliveryMediumType
deliveryMedium = forall a. Maybe a
Prelude.Nothing,
      $sel:destination:CodeDeliveryDetailsType' :: Maybe Text
destination = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the attribute that Amazon Cognito verifies with the code.
codeDeliveryDetailsType_attributeName :: Lens.Lens' CodeDeliveryDetailsType (Prelude.Maybe Prelude.Text)
codeDeliveryDetailsType_attributeName :: Lens' CodeDeliveryDetailsType (Maybe Text)
codeDeliveryDetailsType_attributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeDeliveryDetailsType' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:CodeDeliveryDetailsType' :: CodeDeliveryDetailsType -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: CodeDeliveryDetailsType
s@CodeDeliveryDetailsType' {} Maybe Text
a -> CodeDeliveryDetailsType
s {$sel:attributeName:CodeDeliveryDetailsType' :: Maybe Text
attributeName = Maybe Text
a} :: CodeDeliveryDetailsType)

-- | The method that Amazon Cognito used to send the code.
codeDeliveryDetailsType_deliveryMedium :: Lens.Lens' CodeDeliveryDetailsType (Prelude.Maybe DeliveryMediumType)
codeDeliveryDetailsType_deliveryMedium :: Lens' CodeDeliveryDetailsType (Maybe DeliveryMediumType)
codeDeliveryDetailsType_deliveryMedium = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeDeliveryDetailsType' {Maybe DeliveryMediumType
deliveryMedium :: Maybe DeliveryMediumType
$sel:deliveryMedium:CodeDeliveryDetailsType' :: CodeDeliveryDetailsType -> Maybe DeliveryMediumType
deliveryMedium} -> Maybe DeliveryMediumType
deliveryMedium) (\s :: CodeDeliveryDetailsType
s@CodeDeliveryDetailsType' {} Maybe DeliveryMediumType
a -> CodeDeliveryDetailsType
s {$sel:deliveryMedium:CodeDeliveryDetailsType' :: Maybe DeliveryMediumType
deliveryMedium = Maybe DeliveryMediumType
a} :: CodeDeliveryDetailsType)

-- | The email address or phone number destination where Amazon Cognito sent
-- the code.
codeDeliveryDetailsType_destination :: Lens.Lens' CodeDeliveryDetailsType (Prelude.Maybe Prelude.Text)
codeDeliveryDetailsType_destination :: Lens' CodeDeliveryDetailsType (Maybe Text)
codeDeliveryDetailsType_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeDeliveryDetailsType' {Maybe Text
destination :: Maybe Text
$sel:destination:CodeDeliveryDetailsType' :: CodeDeliveryDetailsType -> Maybe Text
destination} -> Maybe Text
destination) (\s :: CodeDeliveryDetailsType
s@CodeDeliveryDetailsType' {} Maybe Text
a -> CodeDeliveryDetailsType
s {$sel:destination:CodeDeliveryDetailsType' :: Maybe Text
destination = Maybe Text
a} :: CodeDeliveryDetailsType)

instance Data.FromJSON CodeDeliveryDetailsType where
  parseJSON :: Value -> Parser CodeDeliveryDetailsType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CodeDeliveryDetailsType"
      ( \Object
x ->
          Maybe Text
-> Maybe DeliveryMediumType
-> Maybe Text
-> CodeDeliveryDetailsType
CodeDeliveryDetailsType'
            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
"AttributeName")
            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
"DeliveryMedium")
            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
"Destination")
      )

instance Prelude.Hashable CodeDeliveryDetailsType where
  hashWithSalt :: Int -> CodeDeliveryDetailsType -> Int
hashWithSalt Int
_salt CodeDeliveryDetailsType' {Maybe Text
Maybe DeliveryMediumType
destination :: Maybe Text
deliveryMedium :: Maybe DeliveryMediumType
attributeName :: Maybe Text
$sel:destination:CodeDeliveryDetailsType' :: CodeDeliveryDetailsType -> Maybe Text
$sel:deliveryMedium:CodeDeliveryDetailsType' :: CodeDeliveryDetailsType -> Maybe DeliveryMediumType
$sel:attributeName:CodeDeliveryDetailsType' :: CodeDeliveryDetailsType -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
attributeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeliveryMediumType
deliveryMedium
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destination

instance Prelude.NFData CodeDeliveryDetailsType where
  rnf :: CodeDeliveryDetailsType -> ()
rnf CodeDeliveryDetailsType' {Maybe Text
Maybe DeliveryMediumType
destination :: Maybe Text
deliveryMedium :: Maybe DeliveryMediumType
attributeName :: Maybe Text
$sel:destination:CodeDeliveryDetailsType' :: CodeDeliveryDetailsType -> Maybe Text
$sel:deliveryMedium:CodeDeliveryDetailsType' :: CodeDeliveryDetailsType -> Maybe DeliveryMediumType
$sel:attributeName:CodeDeliveryDetailsType' :: CodeDeliveryDetailsType -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
attributeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DeliveryMediumType
deliveryMedium
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destination