{-# 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.Connect.Types.UserSummary
-- 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.Connect.Types.UserSummary where

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

-- | Contains summary information about a user.
--
-- /See:/ 'newUserSummary' smart constructor.
data UserSummary = UserSummary'
  { -- | The Amazon Resource Name (ARN) of the user account.
    UserSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Connect user name of the user account.
    UserSummary -> Maybe Text
username :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the user account.
    UserSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (UserSummary -> UserSummary -> Bool
(UserSummary -> UserSummary -> Bool)
-> (UserSummary -> UserSummary -> Bool) -> Eq UserSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserSummary -> UserSummary -> Bool
$c/= :: UserSummary -> UserSummary -> Bool
== :: UserSummary -> UserSummary -> Bool
$c== :: UserSummary -> UserSummary -> Bool
Prelude.Eq, ReadPrec [UserSummary]
ReadPrec UserSummary
Int -> ReadS UserSummary
ReadS [UserSummary]
(Int -> ReadS UserSummary)
-> ReadS [UserSummary]
-> ReadPrec UserSummary
-> ReadPrec [UserSummary]
-> Read UserSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserSummary]
$creadListPrec :: ReadPrec [UserSummary]
readPrec :: ReadPrec UserSummary
$creadPrec :: ReadPrec UserSummary
readList :: ReadS [UserSummary]
$creadList :: ReadS [UserSummary]
readsPrec :: Int -> ReadS UserSummary
$creadsPrec :: Int -> ReadS UserSummary
Prelude.Read, Int -> UserSummary -> ShowS
[UserSummary] -> ShowS
UserSummary -> String
(Int -> UserSummary -> ShowS)
-> (UserSummary -> String)
-> ([UserSummary] -> ShowS)
-> Show UserSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserSummary] -> ShowS
$cshowList :: [UserSummary] -> ShowS
show :: UserSummary -> String
$cshow :: UserSummary -> String
showsPrec :: Int -> UserSummary -> ShowS
$cshowsPrec :: Int -> UserSummary -> ShowS
Prelude.Show, (forall x. UserSummary -> Rep UserSummary x)
-> (forall x. Rep UserSummary x -> UserSummary)
-> Generic UserSummary
forall x. Rep UserSummary x -> UserSummary
forall x. UserSummary -> Rep UserSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserSummary x -> UserSummary
$cfrom :: forall x. UserSummary -> Rep UserSummary x
Prelude.Generic)

-- |
-- Create a value of 'UserSummary' 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:
--
-- 'arn', 'userSummary_arn' - The Amazon Resource Name (ARN) of the user account.
--
-- 'username', 'userSummary_username' - The Amazon Connect user name of the user account.
--
-- 'id', 'userSummary_id' - The identifier of the user account.
newUserSummary ::
  UserSummary
newUserSummary :: UserSummary
newUserSummary =
  UserSummary' :: Maybe Text -> Maybe Text -> Maybe Text -> UserSummary
UserSummary'
    { $sel:arn:UserSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:username:UserSummary' :: Maybe Text
username = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:UserSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the user account.
userSummary_arn :: Lens.Lens' UserSummary (Prelude.Maybe Prelude.Text)
userSummary_arn :: (Maybe Text -> f (Maybe Text)) -> UserSummary -> f UserSummary
userSummary_arn = (UserSummary -> Maybe Text)
-> (UserSummary -> Maybe Text -> UserSummary)
-> Lens UserSummary UserSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:UserSummary' :: UserSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: UserSummary
s@UserSummary' {} Maybe Text
a -> UserSummary
s {$sel:arn:UserSummary' :: Maybe Text
arn = Maybe Text
a} :: UserSummary)

-- | The Amazon Connect user name of the user account.
userSummary_username :: Lens.Lens' UserSummary (Prelude.Maybe Prelude.Text)
userSummary_username :: (Maybe Text -> f (Maybe Text)) -> UserSummary -> f UserSummary
userSummary_username = (UserSummary -> Maybe Text)
-> (UserSummary -> Maybe Text -> UserSummary)
-> Lens UserSummary UserSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserSummary' {Maybe Text
username :: Maybe Text
$sel:username:UserSummary' :: UserSummary -> Maybe Text
username} -> Maybe Text
username) (\s :: UserSummary
s@UserSummary' {} Maybe Text
a -> UserSummary
s {$sel:username:UserSummary' :: Maybe Text
username = Maybe Text
a} :: UserSummary)

-- | The identifier of the user account.
userSummary_id :: Lens.Lens' UserSummary (Prelude.Maybe Prelude.Text)
userSummary_id :: (Maybe Text -> f (Maybe Text)) -> UserSummary -> f UserSummary
userSummary_id = (UserSummary -> Maybe Text)
-> (UserSummary -> Maybe Text -> UserSummary)
-> Lens UserSummary UserSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserSummary' {Maybe Text
id :: Maybe Text
$sel:id:UserSummary' :: UserSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: UserSummary
s@UserSummary' {} Maybe Text
a -> UserSummary
s {$sel:id:UserSummary' :: Maybe Text
id = Maybe Text
a} :: UserSummary)

instance Core.FromJSON UserSummary where
  parseJSON :: Value -> Parser UserSummary
parseJSON =
    String
-> (Object -> Parser UserSummary) -> Value -> Parser UserSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserSummary"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> UserSummary
UserSummary'
            (Maybe Text -> Maybe Text -> Maybe Text -> UserSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> UserSummary)
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
"Arn")
            Parser (Maybe Text -> Maybe Text -> UserSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> UserSummary)
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
"Username")
            Parser (Maybe Text -> UserSummary)
-> Parser (Maybe Text) -> Parser UserSummary
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
"Id")
      )

instance Prelude.Hashable UserSummary

instance Prelude.NFData UserSummary