{-# 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.CognitoIdentity.Types.UnprocessedIdentityId
-- 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.CognitoIdentity.Types.UnprocessedIdentityId where

import Amazonka.CognitoIdentity.Types.CognitoErrorCode
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

-- | An array of UnprocessedIdentityId objects, each of which contains an
-- ErrorCode and IdentityId.
--
-- /See:/ 'newUnprocessedIdentityId' smart constructor.
data UnprocessedIdentityId = UnprocessedIdentityId'
  { -- | The error code indicating the type of error that occurred.
    UnprocessedIdentityId -> Maybe CognitoErrorCode
errorCode :: Prelude.Maybe CognitoErrorCode,
    -- | A unique identifier in the format REGION:GUID.
    UnprocessedIdentityId -> Maybe Text
identityId :: Prelude.Maybe Prelude.Text
  }
  deriving (UnprocessedIdentityId -> UnprocessedIdentityId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnprocessedIdentityId -> UnprocessedIdentityId -> Bool
$c/= :: UnprocessedIdentityId -> UnprocessedIdentityId -> Bool
== :: UnprocessedIdentityId -> UnprocessedIdentityId -> Bool
$c== :: UnprocessedIdentityId -> UnprocessedIdentityId -> Bool
Prelude.Eq, ReadPrec [UnprocessedIdentityId]
ReadPrec UnprocessedIdentityId
Int -> ReadS UnprocessedIdentityId
ReadS [UnprocessedIdentityId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnprocessedIdentityId]
$creadListPrec :: ReadPrec [UnprocessedIdentityId]
readPrec :: ReadPrec UnprocessedIdentityId
$creadPrec :: ReadPrec UnprocessedIdentityId
readList :: ReadS [UnprocessedIdentityId]
$creadList :: ReadS [UnprocessedIdentityId]
readsPrec :: Int -> ReadS UnprocessedIdentityId
$creadsPrec :: Int -> ReadS UnprocessedIdentityId
Prelude.Read, Int -> UnprocessedIdentityId -> ShowS
[UnprocessedIdentityId] -> ShowS
UnprocessedIdentityId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnprocessedIdentityId] -> ShowS
$cshowList :: [UnprocessedIdentityId] -> ShowS
show :: UnprocessedIdentityId -> String
$cshow :: UnprocessedIdentityId -> String
showsPrec :: Int -> UnprocessedIdentityId -> ShowS
$cshowsPrec :: Int -> UnprocessedIdentityId -> ShowS
Prelude.Show, forall x. Rep UnprocessedIdentityId x -> UnprocessedIdentityId
forall x. UnprocessedIdentityId -> Rep UnprocessedIdentityId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnprocessedIdentityId x -> UnprocessedIdentityId
$cfrom :: forall x. UnprocessedIdentityId -> Rep UnprocessedIdentityId x
Prelude.Generic)

-- |
-- Create a value of 'UnprocessedIdentityId' 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:
--
-- 'errorCode', 'unprocessedIdentityId_errorCode' - The error code indicating the type of error that occurred.
--
-- 'identityId', 'unprocessedIdentityId_identityId' - A unique identifier in the format REGION:GUID.
newUnprocessedIdentityId ::
  UnprocessedIdentityId
newUnprocessedIdentityId :: UnprocessedIdentityId
newUnprocessedIdentityId =
  UnprocessedIdentityId'
    { $sel:errorCode:UnprocessedIdentityId' :: Maybe CognitoErrorCode
errorCode = forall a. Maybe a
Prelude.Nothing,
      $sel:identityId:UnprocessedIdentityId' :: Maybe Text
identityId = forall a. Maybe a
Prelude.Nothing
    }

-- | The error code indicating the type of error that occurred.
unprocessedIdentityId_errorCode :: Lens.Lens' UnprocessedIdentityId (Prelude.Maybe CognitoErrorCode)
unprocessedIdentityId_errorCode :: Lens' UnprocessedIdentityId (Maybe CognitoErrorCode)
unprocessedIdentityId_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedIdentityId' {Maybe CognitoErrorCode
errorCode :: Maybe CognitoErrorCode
$sel:errorCode:UnprocessedIdentityId' :: UnprocessedIdentityId -> Maybe CognitoErrorCode
errorCode} -> Maybe CognitoErrorCode
errorCode) (\s :: UnprocessedIdentityId
s@UnprocessedIdentityId' {} Maybe CognitoErrorCode
a -> UnprocessedIdentityId
s {$sel:errorCode:UnprocessedIdentityId' :: Maybe CognitoErrorCode
errorCode = Maybe CognitoErrorCode
a} :: UnprocessedIdentityId)

-- | A unique identifier in the format REGION:GUID.
unprocessedIdentityId_identityId :: Lens.Lens' UnprocessedIdentityId (Prelude.Maybe Prelude.Text)
unprocessedIdentityId_identityId :: Lens' UnprocessedIdentityId (Maybe Text)
unprocessedIdentityId_identityId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedIdentityId' {Maybe Text
identityId :: Maybe Text
$sel:identityId:UnprocessedIdentityId' :: UnprocessedIdentityId -> Maybe Text
identityId} -> Maybe Text
identityId) (\s :: UnprocessedIdentityId
s@UnprocessedIdentityId' {} Maybe Text
a -> UnprocessedIdentityId
s {$sel:identityId:UnprocessedIdentityId' :: Maybe Text
identityId = Maybe Text
a} :: UnprocessedIdentityId)

instance Data.FromJSON UnprocessedIdentityId where
  parseJSON :: Value -> Parser UnprocessedIdentityId
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UnprocessedIdentityId"
      ( \Object
x ->
          Maybe CognitoErrorCode -> Maybe Text -> UnprocessedIdentityId
UnprocessedIdentityId'
            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
"ErrorCode")
            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
"IdentityId")
      )

instance Prelude.Hashable UnprocessedIdentityId where
  hashWithSalt :: Int -> UnprocessedIdentityId -> Int
hashWithSalt Int
_salt UnprocessedIdentityId' {Maybe Text
Maybe CognitoErrorCode
identityId :: Maybe Text
errorCode :: Maybe CognitoErrorCode
$sel:identityId:UnprocessedIdentityId' :: UnprocessedIdentityId -> Maybe Text
$sel:errorCode:UnprocessedIdentityId' :: UnprocessedIdentityId -> Maybe CognitoErrorCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CognitoErrorCode
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identityId

instance Prelude.NFData UnprocessedIdentityId where
  rnf :: UnprocessedIdentityId -> ()
rnf UnprocessedIdentityId' {Maybe Text
Maybe CognitoErrorCode
identityId :: Maybe Text
errorCode :: Maybe CognitoErrorCode
$sel:identityId:UnprocessedIdentityId' :: UnprocessedIdentityId -> Maybe Text
$sel:errorCode:UnprocessedIdentityId' :: UnprocessedIdentityId -> Maybe CognitoErrorCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CognitoErrorCode
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identityId