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

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

-- | Contextual data such as the user\'s device fingerprint, IP address, or
-- location used for evaluating the risk of an unexpected event by Amazon
-- Cognito advanced security.
--
-- /See:/ 'newUserContextDataType' smart constructor.
data UserContextDataType = UserContextDataType'
  { -- | Contextual data such as the user\'s device fingerprint, IP address, or
    -- location used for evaluating the risk of an unexpected event by Amazon
    -- Cognito advanced security.
    UserContextDataType -> Maybe Text
encodedData :: Prelude.Maybe Prelude.Text
  }
  deriving (UserContextDataType -> UserContextDataType -> Bool
(UserContextDataType -> UserContextDataType -> Bool)
-> (UserContextDataType -> UserContextDataType -> Bool)
-> Eq UserContextDataType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserContextDataType -> UserContextDataType -> Bool
$c/= :: UserContextDataType -> UserContextDataType -> Bool
== :: UserContextDataType -> UserContextDataType -> Bool
$c== :: UserContextDataType -> UserContextDataType -> Bool
Prelude.Eq, ReadPrec [UserContextDataType]
ReadPrec UserContextDataType
Int -> ReadS UserContextDataType
ReadS [UserContextDataType]
(Int -> ReadS UserContextDataType)
-> ReadS [UserContextDataType]
-> ReadPrec UserContextDataType
-> ReadPrec [UserContextDataType]
-> Read UserContextDataType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserContextDataType]
$creadListPrec :: ReadPrec [UserContextDataType]
readPrec :: ReadPrec UserContextDataType
$creadPrec :: ReadPrec UserContextDataType
readList :: ReadS [UserContextDataType]
$creadList :: ReadS [UserContextDataType]
readsPrec :: Int -> ReadS UserContextDataType
$creadsPrec :: Int -> ReadS UserContextDataType
Prelude.Read, Int -> UserContextDataType -> ShowS
[UserContextDataType] -> ShowS
UserContextDataType -> String
(Int -> UserContextDataType -> ShowS)
-> (UserContextDataType -> String)
-> ([UserContextDataType] -> ShowS)
-> Show UserContextDataType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserContextDataType] -> ShowS
$cshowList :: [UserContextDataType] -> ShowS
show :: UserContextDataType -> String
$cshow :: UserContextDataType -> String
showsPrec :: Int -> UserContextDataType -> ShowS
$cshowsPrec :: Int -> UserContextDataType -> ShowS
Prelude.Show, (forall x. UserContextDataType -> Rep UserContextDataType x)
-> (forall x. Rep UserContextDataType x -> UserContextDataType)
-> Generic UserContextDataType
forall x. Rep UserContextDataType x -> UserContextDataType
forall x. UserContextDataType -> Rep UserContextDataType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserContextDataType x -> UserContextDataType
$cfrom :: forall x. UserContextDataType -> Rep UserContextDataType x
Prelude.Generic)

-- |
-- Create a value of 'UserContextDataType' 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:
--
-- 'encodedData', 'userContextDataType_encodedData' - Contextual data such as the user\'s device fingerprint, IP address, or
-- location used for evaluating the risk of an unexpected event by Amazon
-- Cognito advanced security.
newUserContextDataType ::
  UserContextDataType
newUserContextDataType :: UserContextDataType
newUserContextDataType =
  UserContextDataType' :: Maybe Text -> UserContextDataType
UserContextDataType' {$sel:encodedData:UserContextDataType' :: Maybe Text
encodedData = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | Contextual data such as the user\'s device fingerprint, IP address, or
-- location used for evaluating the risk of an unexpected event by Amazon
-- Cognito advanced security.
userContextDataType_encodedData :: Lens.Lens' UserContextDataType (Prelude.Maybe Prelude.Text)
userContextDataType_encodedData :: (Maybe Text -> f (Maybe Text))
-> UserContextDataType -> f UserContextDataType
userContextDataType_encodedData = (UserContextDataType -> Maybe Text)
-> (UserContextDataType -> Maybe Text -> UserContextDataType)
-> Lens
     UserContextDataType UserContextDataType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserContextDataType' {Maybe Text
encodedData :: Maybe Text
$sel:encodedData:UserContextDataType' :: UserContextDataType -> Maybe Text
encodedData} -> Maybe Text
encodedData) (\s :: UserContextDataType
s@UserContextDataType' {} Maybe Text
a -> UserContextDataType
s {$sel:encodedData:UserContextDataType' :: Maybe Text
encodedData = Maybe Text
a} :: UserContextDataType)

instance Prelude.Hashable UserContextDataType

instance Prelude.NFData UserContextDataType

instance Core.ToJSON UserContextDataType where
  toJSON :: UserContextDataType -> Value
toJSON UserContextDataType' {Maybe Text
encodedData :: Maybe Text
$sel:encodedData:UserContextDataType' :: UserContextDataType -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"EncodedData" 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
encodedData]
      )