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

import Amazonka.CognitoIdentityProvider.Types.DeliveryMediumType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The code delivery details being returned from the server.
--
-- /See:/ 'newCodeDeliveryDetailsType' smart constructor.
data CodeDeliveryDetailsType = CodeDeliveryDetailsType'
  { -- | The destination for the code delivery details.
    CodeDeliveryDetailsType -> Maybe Text
destination :: Prelude.Maybe Prelude.Text,
    -- | The delivery medium (email message or phone number).
    CodeDeliveryDetailsType -> Maybe DeliveryMediumType
deliveryMedium :: Prelude.Maybe DeliveryMediumType,
    -- | The attribute name.
    CodeDeliveryDetailsType -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text
  }
  deriving (CodeDeliveryDetailsType -> CodeDeliveryDetailsType -> Bool
(CodeDeliveryDetailsType -> CodeDeliveryDetailsType -> Bool)
-> (CodeDeliveryDetailsType -> CodeDeliveryDetailsType -> Bool)
-> Eq CodeDeliveryDetailsType
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]
(Int -> ReadS CodeDeliveryDetailsType)
-> ReadS [CodeDeliveryDetailsType]
-> ReadPrec CodeDeliveryDetailsType
-> ReadPrec [CodeDeliveryDetailsType]
-> Read 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
(Int -> CodeDeliveryDetailsType -> ShowS)
-> (CodeDeliveryDetailsType -> String)
-> ([CodeDeliveryDetailsType] -> ShowS)
-> Show CodeDeliveryDetailsType
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.
 CodeDeliveryDetailsType -> Rep CodeDeliveryDetailsType x)
-> (forall x.
    Rep CodeDeliveryDetailsType x -> CodeDeliveryDetailsType)
-> Generic CodeDeliveryDetailsType
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:
--
-- 'destination', 'codeDeliveryDetailsType_destination' - The destination for the code delivery details.
--
-- 'deliveryMedium', 'codeDeliveryDetailsType_deliveryMedium' - The delivery medium (email message or phone number).
--
-- 'attributeName', 'codeDeliveryDetailsType_attributeName' - The attribute name.
newCodeDeliveryDetailsType ::
  CodeDeliveryDetailsType
newCodeDeliveryDetailsType :: CodeDeliveryDetailsType
newCodeDeliveryDetailsType =
  CodeDeliveryDetailsType' :: Maybe Text
-> Maybe DeliveryMediumType
-> Maybe Text
-> CodeDeliveryDetailsType
CodeDeliveryDetailsType'
    { $sel:destination:CodeDeliveryDetailsType' :: Maybe Text
destination =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deliveryMedium:CodeDeliveryDetailsType' :: Maybe DeliveryMediumType
deliveryMedium = Maybe DeliveryMediumType
forall a. Maybe a
Prelude.Nothing,
      $sel:attributeName:CodeDeliveryDetailsType' :: Maybe Text
attributeName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The destination for the code delivery details.
codeDeliveryDetailsType_destination :: Lens.Lens' CodeDeliveryDetailsType (Prelude.Maybe Prelude.Text)
codeDeliveryDetailsType_destination :: (Maybe Text -> f (Maybe Text))
-> CodeDeliveryDetailsType -> f CodeDeliveryDetailsType
codeDeliveryDetailsType_destination = (CodeDeliveryDetailsType -> Maybe Text)
-> (CodeDeliveryDetailsType
    -> Maybe Text -> CodeDeliveryDetailsType)
-> Lens
     CodeDeliveryDetailsType
     CodeDeliveryDetailsType
     (Maybe Text)
     (Maybe Text)
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)

-- | The delivery medium (email message or phone number).
codeDeliveryDetailsType_deliveryMedium :: Lens.Lens' CodeDeliveryDetailsType (Prelude.Maybe DeliveryMediumType)
codeDeliveryDetailsType_deliveryMedium :: (Maybe DeliveryMediumType -> f (Maybe DeliveryMediumType))
-> CodeDeliveryDetailsType -> f CodeDeliveryDetailsType
codeDeliveryDetailsType_deliveryMedium = (CodeDeliveryDetailsType -> Maybe DeliveryMediumType)
-> (CodeDeliveryDetailsType
    -> Maybe DeliveryMediumType -> CodeDeliveryDetailsType)
-> Lens
     CodeDeliveryDetailsType
     CodeDeliveryDetailsType
     (Maybe DeliveryMediumType)
     (Maybe DeliveryMediumType)
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 attribute name.
codeDeliveryDetailsType_attributeName :: Lens.Lens' CodeDeliveryDetailsType (Prelude.Maybe Prelude.Text)
codeDeliveryDetailsType_attributeName :: (Maybe Text -> f (Maybe Text))
-> CodeDeliveryDetailsType -> f CodeDeliveryDetailsType
codeDeliveryDetailsType_attributeName = (CodeDeliveryDetailsType -> Maybe Text)
-> (CodeDeliveryDetailsType
    -> Maybe Text -> CodeDeliveryDetailsType)
-> Lens
     CodeDeliveryDetailsType
     CodeDeliveryDetailsType
     (Maybe Text)
     (Maybe Text)
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)

instance Core.FromJSON CodeDeliveryDetailsType where
  parseJSON :: Value -> Parser CodeDeliveryDetailsType
parseJSON =
    String
-> (Object -> Parser CodeDeliveryDetailsType)
-> Value
-> Parser CodeDeliveryDetailsType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CodeDeliveryDetailsType"
      ( \Object
x ->
          Maybe Text
-> Maybe DeliveryMediumType
-> Maybe Text
-> CodeDeliveryDetailsType
CodeDeliveryDetailsType'
            (Maybe Text
 -> Maybe DeliveryMediumType
 -> Maybe Text
 -> CodeDeliveryDetailsType)
-> Parser (Maybe Text)
-> Parser
     (Maybe DeliveryMediumType -> Maybe Text -> CodeDeliveryDetailsType)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Destination")
            Parser
  (Maybe DeliveryMediumType -> Maybe Text -> CodeDeliveryDetailsType)
-> Parser (Maybe DeliveryMediumType)
-> Parser (Maybe Text -> CodeDeliveryDetailsType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DeliveryMediumType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeliveryMedium")
            Parser (Maybe Text -> CodeDeliveryDetailsType)
-> Parser (Maybe Text) -> Parser CodeDeliveryDetailsType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AttributeName")
      )

instance Prelude.Hashable CodeDeliveryDetailsType

instance Prelude.NFData CodeDeliveryDetailsType