{-# 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.WorkDocs.Types.UserMetadata
-- 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.WorkDocs.Types.UserMetadata where

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

-- | Describes the metadata of the user.
--
-- /See:/ 'newUserMetadata' smart constructor.
data UserMetadata = UserMetadata'
  { -- | The given name of the user before a rename operation.
    UserMetadata -> Maybe Text
givenName :: Prelude.Maybe Prelude.Text,
    -- | The name of the user.
    UserMetadata -> Maybe Text
username :: Prelude.Maybe Prelude.Text,
    -- | The email address of the user.
    UserMetadata -> Maybe Text
emailAddress :: Prelude.Maybe Prelude.Text,
    -- | The ID of the user.
    UserMetadata -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The surname of the user.
    UserMetadata -> Maybe Text
surname :: Prelude.Maybe Prelude.Text
  }
  deriving (UserMetadata -> UserMetadata -> Bool
(UserMetadata -> UserMetadata -> Bool)
-> (UserMetadata -> UserMetadata -> Bool) -> Eq UserMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserMetadata -> UserMetadata -> Bool
$c/= :: UserMetadata -> UserMetadata -> Bool
== :: UserMetadata -> UserMetadata -> Bool
$c== :: UserMetadata -> UserMetadata -> Bool
Prelude.Eq, ReadPrec [UserMetadata]
ReadPrec UserMetadata
Int -> ReadS UserMetadata
ReadS [UserMetadata]
(Int -> ReadS UserMetadata)
-> ReadS [UserMetadata]
-> ReadPrec UserMetadata
-> ReadPrec [UserMetadata]
-> Read UserMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserMetadata]
$creadListPrec :: ReadPrec [UserMetadata]
readPrec :: ReadPrec UserMetadata
$creadPrec :: ReadPrec UserMetadata
readList :: ReadS [UserMetadata]
$creadList :: ReadS [UserMetadata]
readsPrec :: Int -> ReadS UserMetadata
$creadsPrec :: Int -> ReadS UserMetadata
Prelude.Read, Int -> UserMetadata -> ShowS
[UserMetadata] -> ShowS
UserMetadata -> String
(Int -> UserMetadata -> ShowS)
-> (UserMetadata -> String)
-> ([UserMetadata] -> ShowS)
-> Show UserMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserMetadata] -> ShowS
$cshowList :: [UserMetadata] -> ShowS
show :: UserMetadata -> String
$cshow :: UserMetadata -> String
showsPrec :: Int -> UserMetadata -> ShowS
$cshowsPrec :: Int -> UserMetadata -> ShowS
Prelude.Show, (forall x. UserMetadata -> Rep UserMetadata x)
-> (forall x. Rep UserMetadata x -> UserMetadata)
-> Generic UserMetadata
forall x. Rep UserMetadata x -> UserMetadata
forall x. UserMetadata -> Rep UserMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserMetadata x -> UserMetadata
$cfrom :: forall x. UserMetadata -> Rep UserMetadata x
Prelude.Generic)

-- |
-- Create a value of 'UserMetadata' 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:
--
-- 'givenName', 'userMetadata_givenName' - The given name of the user before a rename operation.
--
-- 'username', 'userMetadata_username' - The name of the user.
--
-- 'emailAddress', 'userMetadata_emailAddress' - The email address of the user.
--
-- 'id', 'userMetadata_id' - The ID of the user.
--
-- 'surname', 'userMetadata_surname' - The surname of the user.
newUserMetadata ::
  UserMetadata
newUserMetadata :: UserMetadata
newUserMetadata =
  UserMetadata' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> UserMetadata
UserMetadata'
    { $sel:givenName:UserMetadata' :: Maybe Text
givenName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:username:UserMetadata' :: Maybe Text
username = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:emailAddress:UserMetadata' :: Maybe Text
emailAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:UserMetadata' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:surname:UserMetadata' :: Maybe Text
surname = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The given name of the user before a rename operation.
userMetadata_givenName :: Lens.Lens' UserMetadata (Prelude.Maybe Prelude.Text)
userMetadata_givenName :: (Maybe Text -> f (Maybe Text)) -> UserMetadata -> f UserMetadata
userMetadata_givenName = (UserMetadata -> Maybe Text)
-> (UserMetadata -> Maybe Text -> UserMetadata)
-> Lens UserMetadata UserMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserMetadata' {Maybe Text
givenName :: Maybe Text
$sel:givenName:UserMetadata' :: UserMetadata -> Maybe Text
givenName} -> Maybe Text
givenName) (\s :: UserMetadata
s@UserMetadata' {} Maybe Text
a -> UserMetadata
s {$sel:givenName:UserMetadata' :: Maybe Text
givenName = Maybe Text
a} :: UserMetadata)

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

-- | The email address of the user.
userMetadata_emailAddress :: Lens.Lens' UserMetadata (Prelude.Maybe Prelude.Text)
userMetadata_emailAddress :: (Maybe Text -> f (Maybe Text)) -> UserMetadata -> f UserMetadata
userMetadata_emailAddress = (UserMetadata -> Maybe Text)
-> (UserMetadata -> Maybe Text -> UserMetadata)
-> Lens UserMetadata UserMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserMetadata' {Maybe Text
emailAddress :: Maybe Text
$sel:emailAddress:UserMetadata' :: UserMetadata -> Maybe Text
emailAddress} -> Maybe Text
emailAddress) (\s :: UserMetadata
s@UserMetadata' {} Maybe Text
a -> UserMetadata
s {$sel:emailAddress:UserMetadata' :: Maybe Text
emailAddress = Maybe Text
a} :: UserMetadata)

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

-- | The surname of the user.
userMetadata_surname :: Lens.Lens' UserMetadata (Prelude.Maybe Prelude.Text)
userMetadata_surname :: (Maybe Text -> f (Maybe Text)) -> UserMetadata -> f UserMetadata
userMetadata_surname = (UserMetadata -> Maybe Text)
-> (UserMetadata -> Maybe Text -> UserMetadata)
-> Lens UserMetadata UserMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserMetadata' {Maybe Text
surname :: Maybe Text
$sel:surname:UserMetadata' :: UserMetadata -> Maybe Text
surname} -> Maybe Text
surname) (\s :: UserMetadata
s@UserMetadata' {} Maybe Text
a -> UserMetadata
s {$sel:surname:UserMetadata' :: Maybe Text
surname = Maybe Text
a} :: UserMetadata)

instance Core.FromJSON UserMetadata where
  parseJSON :: Value -> Parser UserMetadata
parseJSON =
    String
-> (Object -> Parser UserMetadata) -> Value -> Parser UserMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserMetadata"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> UserMetadata
UserMetadata'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> UserMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> UserMetadata)
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
"GivenName")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> UserMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> UserMetadata)
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 -> Maybe Text -> Maybe Text -> UserMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> UserMetadata)
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
"EmailAddress")
            Parser (Maybe Text -> Maybe Text -> UserMetadata)
-> Parser (Maybe Text) -> Parser (Maybe Text -> UserMetadata)
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")
            Parser (Maybe Text -> UserMetadata)
-> Parser (Maybe Text) -> Parser UserMetadata
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
"Surname")
      )

instance Prelude.Hashable UserMetadata

instance Prelude.NFData UserMetadata