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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A container for information about an identity provider for a user pool.
--
-- /See:/ 'newProviderUserIdentifierType' smart constructor.
data ProviderUserIdentifierType = ProviderUserIdentifierType'
  { -- | The value of the provider attribute to link to, for example,
    -- @xxxxx_account@.
    ProviderUserIdentifierType -> Maybe Text
providerAttributeValue :: Prelude.Maybe Prelude.Text,
    -- | The name of the provider attribute to link to, for example, @NameID@.
    ProviderUserIdentifierType -> Maybe Text
providerAttributeName :: Prelude.Maybe Prelude.Text,
    -- | The name of the provider, for example, Facebook, Google, or Login with
    -- Amazon.
    ProviderUserIdentifierType -> Maybe Text
providerName :: Prelude.Maybe Prelude.Text
  }
  deriving (ProviderUserIdentifierType -> ProviderUserIdentifierType -> Bool
(ProviderUserIdentifierType -> ProviderUserIdentifierType -> Bool)
-> (ProviderUserIdentifierType
    -> ProviderUserIdentifierType -> Bool)
-> Eq ProviderUserIdentifierType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProviderUserIdentifierType -> ProviderUserIdentifierType -> Bool
$c/= :: ProviderUserIdentifierType -> ProviderUserIdentifierType -> Bool
== :: ProviderUserIdentifierType -> ProviderUserIdentifierType -> Bool
$c== :: ProviderUserIdentifierType -> ProviderUserIdentifierType -> Bool
Prelude.Eq, ReadPrec [ProviderUserIdentifierType]
ReadPrec ProviderUserIdentifierType
Int -> ReadS ProviderUserIdentifierType
ReadS [ProviderUserIdentifierType]
(Int -> ReadS ProviderUserIdentifierType)
-> ReadS [ProviderUserIdentifierType]
-> ReadPrec ProviderUserIdentifierType
-> ReadPrec [ProviderUserIdentifierType]
-> Read ProviderUserIdentifierType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProviderUserIdentifierType]
$creadListPrec :: ReadPrec [ProviderUserIdentifierType]
readPrec :: ReadPrec ProviderUserIdentifierType
$creadPrec :: ReadPrec ProviderUserIdentifierType
readList :: ReadS [ProviderUserIdentifierType]
$creadList :: ReadS [ProviderUserIdentifierType]
readsPrec :: Int -> ReadS ProviderUserIdentifierType
$creadsPrec :: Int -> ReadS ProviderUserIdentifierType
Prelude.Read, Int -> ProviderUserIdentifierType -> ShowS
[ProviderUserIdentifierType] -> ShowS
ProviderUserIdentifierType -> String
(Int -> ProviderUserIdentifierType -> ShowS)
-> (ProviderUserIdentifierType -> String)
-> ([ProviderUserIdentifierType] -> ShowS)
-> Show ProviderUserIdentifierType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProviderUserIdentifierType] -> ShowS
$cshowList :: [ProviderUserIdentifierType] -> ShowS
show :: ProviderUserIdentifierType -> String
$cshow :: ProviderUserIdentifierType -> String
showsPrec :: Int -> ProviderUserIdentifierType -> ShowS
$cshowsPrec :: Int -> ProviderUserIdentifierType -> ShowS
Prelude.Show, (forall x.
 ProviderUserIdentifierType -> Rep ProviderUserIdentifierType x)
-> (forall x.
    Rep ProviderUserIdentifierType x -> ProviderUserIdentifierType)
-> Generic ProviderUserIdentifierType
forall x.
Rep ProviderUserIdentifierType x -> ProviderUserIdentifierType
forall x.
ProviderUserIdentifierType -> Rep ProviderUserIdentifierType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProviderUserIdentifierType x -> ProviderUserIdentifierType
$cfrom :: forall x.
ProviderUserIdentifierType -> Rep ProviderUserIdentifierType x
Prelude.Generic)

-- |
-- Create a value of 'ProviderUserIdentifierType' 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:
--
-- 'providerAttributeValue', 'providerUserIdentifierType_providerAttributeValue' - The value of the provider attribute to link to, for example,
-- @xxxxx_account@.
--
-- 'providerAttributeName', 'providerUserIdentifierType_providerAttributeName' - The name of the provider attribute to link to, for example, @NameID@.
--
-- 'providerName', 'providerUserIdentifierType_providerName' - The name of the provider, for example, Facebook, Google, or Login with
-- Amazon.
newProviderUserIdentifierType ::
  ProviderUserIdentifierType
newProviderUserIdentifierType :: ProviderUserIdentifierType
newProviderUserIdentifierType =
  ProviderUserIdentifierType' :: Maybe Text
-> Maybe Text -> Maybe Text -> ProviderUserIdentifierType
ProviderUserIdentifierType'
    { $sel:providerAttributeValue:ProviderUserIdentifierType' :: Maybe Text
providerAttributeValue =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:providerAttributeName:ProviderUserIdentifierType' :: Maybe Text
providerAttributeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:providerName:ProviderUserIdentifierType' :: Maybe Text
providerName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The value of the provider attribute to link to, for example,
-- @xxxxx_account@.
providerUserIdentifierType_providerAttributeValue :: Lens.Lens' ProviderUserIdentifierType (Prelude.Maybe Prelude.Text)
providerUserIdentifierType_providerAttributeValue :: (Maybe Text -> f (Maybe Text))
-> ProviderUserIdentifierType -> f ProviderUserIdentifierType
providerUserIdentifierType_providerAttributeValue = (ProviderUserIdentifierType -> Maybe Text)
-> (ProviderUserIdentifierType
    -> Maybe Text -> ProviderUserIdentifierType)
-> Lens
     ProviderUserIdentifierType
     ProviderUserIdentifierType
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProviderUserIdentifierType' {Maybe Text
providerAttributeValue :: Maybe Text
$sel:providerAttributeValue:ProviderUserIdentifierType' :: ProviderUserIdentifierType -> Maybe Text
providerAttributeValue} -> Maybe Text
providerAttributeValue) (\s :: ProviderUserIdentifierType
s@ProviderUserIdentifierType' {} Maybe Text
a -> ProviderUserIdentifierType
s {$sel:providerAttributeValue:ProviderUserIdentifierType' :: Maybe Text
providerAttributeValue = Maybe Text
a} :: ProviderUserIdentifierType)

-- | The name of the provider attribute to link to, for example, @NameID@.
providerUserIdentifierType_providerAttributeName :: Lens.Lens' ProviderUserIdentifierType (Prelude.Maybe Prelude.Text)
providerUserIdentifierType_providerAttributeName :: (Maybe Text -> f (Maybe Text))
-> ProviderUserIdentifierType -> f ProviderUserIdentifierType
providerUserIdentifierType_providerAttributeName = (ProviderUserIdentifierType -> Maybe Text)
-> (ProviderUserIdentifierType
    -> Maybe Text -> ProviderUserIdentifierType)
-> Lens
     ProviderUserIdentifierType
     ProviderUserIdentifierType
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProviderUserIdentifierType' {Maybe Text
providerAttributeName :: Maybe Text
$sel:providerAttributeName:ProviderUserIdentifierType' :: ProviderUserIdentifierType -> Maybe Text
providerAttributeName} -> Maybe Text
providerAttributeName) (\s :: ProviderUserIdentifierType
s@ProviderUserIdentifierType' {} Maybe Text
a -> ProviderUserIdentifierType
s {$sel:providerAttributeName:ProviderUserIdentifierType' :: Maybe Text
providerAttributeName = Maybe Text
a} :: ProviderUserIdentifierType)

-- | The name of the provider, for example, Facebook, Google, or Login with
-- Amazon.
providerUserIdentifierType_providerName :: Lens.Lens' ProviderUserIdentifierType (Prelude.Maybe Prelude.Text)
providerUserIdentifierType_providerName :: (Maybe Text -> f (Maybe Text))
-> ProviderUserIdentifierType -> f ProviderUserIdentifierType
providerUserIdentifierType_providerName = (ProviderUserIdentifierType -> Maybe Text)
-> (ProviderUserIdentifierType
    -> Maybe Text -> ProviderUserIdentifierType)
-> Lens
     ProviderUserIdentifierType
     ProviderUserIdentifierType
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProviderUserIdentifierType' {Maybe Text
providerName :: Maybe Text
$sel:providerName:ProviderUserIdentifierType' :: ProviderUserIdentifierType -> Maybe Text
providerName} -> Maybe Text
providerName) (\s :: ProviderUserIdentifierType
s@ProviderUserIdentifierType' {} Maybe Text
a -> ProviderUserIdentifierType
s {$sel:providerName:ProviderUserIdentifierType' :: Maybe Text
providerName = Maybe Text
a} :: ProviderUserIdentifierType)

instance Prelude.Hashable ProviderUserIdentifierType

instance Prelude.NFData ProviderUserIdentifierType

instance Core.ToJSON ProviderUserIdentifierType where
  toJSON :: ProviderUserIdentifierType -> Value
toJSON ProviderUserIdentifierType' {Maybe Text
providerName :: Maybe Text
providerAttributeName :: Maybe Text
providerAttributeValue :: Maybe Text
$sel:providerName:ProviderUserIdentifierType' :: ProviderUserIdentifierType -> Maybe Text
$sel:providerAttributeName:ProviderUserIdentifierType' :: ProviderUserIdentifierType -> Maybe Text
$sel:providerAttributeValue:ProviderUserIdentifierType' :: ProviderUserIdentifierType -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ProviderAttributeValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
providerAttributeValue,
            (Text
"ProviderAttributeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
providerAttributeName,
            (Text
"ProviderName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
providerName
          ]
      )