{-# 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 #-}
module Amazonka.WorkMail.Types.User where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkMail.Types.EntityState
import Amazonka.WorkMail.Types.UserRole
data User = User'
{
User -> Maybe Text
email :: Prelude.Maybe Prelude.Text,
User -> Maybe EntityState
state :: Prelude.Maybe EntityState,
User -> Maybe POSIX
disabledDate :: Prelude.Maybe Core.POSIX,
User -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
User -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
User -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
User -> Maybe UserRole
userRole :: Prelude.Maybe UserRole,
User -> Maybe POSIX
enabledDate :: Prelude.Maybe Core.POSIX
}
deriving (User -> User -> Bool
(User -> User -> Bool) -> (User -> User -> Bool) -> Eq User
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: User -> User -> Bool
$c/= :: User -> User -> Bool
== :: User -> User -> Bool
$c== :: User -> User -> Bool
Prelude.Eq, ReadPrec [User]
ReadPrec User
Int -> ReadS User
ReadS [User]
(Int -> ReadS User)
-> ReadS [User] -> ReadPrec User -> ReadPrec [User] -> Read User
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [User]
$creadListPrec :: ReadPrec [User]
readPrec :: ReadPrec User
$creadPrec :: ReadPrec User
readList :: ReadS [User]
$creadList :: ReadS [User]
readsPrec :: Int -> ReadS User
$creadsPrec :: Int -> ReadS User
Prelude.Read, Int -> User -> ShowS
[User] -> ShowS
User -> String
(Int -> User -> ShowS)
-> (User -> String) -> ([User] -> ShowS) -> Show User
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [User] -> ShowS
$cshowList :: [User] -> ShowS
show :: User -> String
$cshow :: User -> String
showsPrec :: Int -> User -> ShowS
$cshowsPrec :: Int -> User -> ShowS
Prelude.Show, (forall x. User -> Rep User x)
-> (forall x. Rep User x -> User) -> Generic User
forall x. Rep User x -> User
forall x. User -> Rep User x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep User x -> User
$cfrom :: forall x. User -> Rep User x
Prelude.Generic)
newUser ::
User
newUser :: User
newUser =
User' :: Maybe Text
-> Maybe EntityState
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe UserRole
-> Maybe POSIX
-> User
User'
{ $sel:email:User' :: Maybe Text
email = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:state:User' :: Maybe EntityState
state = Maybe EntityState
forall a. Maybe a
Prelude.Nothing,
$sel:disabledDate:User' :: Maybe POSIX
disabledDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:name:User' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:User' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:displayName:User' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:userRole:User' :: Maybe UserRole
userRole = Maybe UserRole
forall a. Maybe a
Prelude.Nothing,
$sel:enabledDate:User' :: Maybe POSIX
enabledDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
user_email :: Lens.Lens' User (Prelude.Maybe Prelude.Text)
user_email :: (Maybe Text -> f (Maybe Text)) -> User -> f User
user_email = (User -> Maybe Text)
-> (User -> Maybe Text -> User)
-> Lens User User (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe Text
email :: Maybe Text
$sel:email:User' :: User -> Maybe Text
email} -> Maybe Text
email) (\s :: User
s@User' {} Maybe Text
a -> User
s {$sel:email:User' :: Maybe Text
email = Maybe Text
a} :: User)
user_state :: Lens.Lens' User (Prelude.Maybe EntityState)
user_state :: (Maybe EntityState -> f (Maybe EntityState)) -> User -> f User
user_state = (User -> Maybe EntityState)
-> (User -> Maybe EntityState -> User)
-> Lens User User (Maybe EntityState) (Maybe EntityState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe EntityState
state :: Maybe EntityState
$sel:state:User' :: User -> Maybe EntityState
state} -> Maybe EntityState
state) (\s :: User
s@User' {} Maybe EntityState
a -> User
s {$sel:state:User' :: Maybe EntityState
state = Maybe EntityState
a} :: User)
user_disabledDate :: Lens.Lens' User (Prelude.Maybe Prelude.UTCTime)
user_disabledDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> User -> f User
user_disabledDate = (User -> Maybe POSIX)
-> (User -> Maybe POSIX -> User)
-> Lens User User (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe POSIX
disabledDate :: Maybe POSIX
$sel:disabledDate:User' :: User -> Maybe POSIX
disabledDate} -> Maybe POSIX
disabledDate) (\s :: User
s@User' {} Maybe POSIX
a -> User
s {$sel:disabledDate:User' :: Maybe POSIX
disabledDate = Maybe POSIX
a} :: User) ((Maybe POSIX -> f (Maybe POSIX)) -> User -> f User)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> User
-> f User
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
user_name :: Lens.Lens' User (Prelude.Maybe Prelude.Text)
user_name :: (Maybe Text -> f (Maybe Text)) -> User -> f User
user_name = (User -> Maybe Text)
-> (User -> Maybe Text -> User)
-> Lens User User (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe Text
name :: Maybe Text
$sel:name:User' :: User -> Maybe Text
name} -> Maybe Text
name) (\s :: User
s@User' {} Maybe Text
a -> User
s {$sel:name:User' :: Maybe Text
name = Maybe Text
a} :: User)
user_id :: Lens.Lens' User (Prelude.Maybe Prelude.Text)
user_id :: (Maybe Text -> f (Maybe Text)) -> User -> f User
user_id = (User -> Maybe Text)
-> (User -> Maybe Text -> User)
-> Lens User User (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe Text
id :: Maybe Text
$sel:id:User' :: User -> Maybe Text
id} -> Maybe Text
id) (\s :: User
s@User' {} Maybe Text
a -> User
s {$sel:id:User' :: Maybe Text
id = Maybe Text
a} :: User)
user_displayName :: Lens.Lens' User (Prelude.Maybe Prelude.Text)
user_displayName :: (Maybe Text -> f (Maybe Text)) -> User -> f User
user_displayName = (User -> Maybe Text)
-> (User -> Maybe Text -> User)
-> Lens User User (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe Text
displayName :: Maybe Text
$sel:displayName:User' :: User -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: User
s@User' {} Maybe Text
a -> User
s {$sel:displayName:User' :: Maybe Text
displayName = Maybe Text
a} :: User)
user_userRole :: Lens.Lens' User (Prelude.Maybe UserRole)
user_userRole :: (Maybe UserRole -> f (Maybe UserRole)) -> User -> f User
user_userRole = (User -> Maybe UserRole)
-> (User -> Maybe UserRole -> User)
-> Lens User User (Maybe UserRole) (Maybe UserRole)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe UserRole
userRole :: Maybe UserRole
$sel:userRole:User' :: User -> Maybe UserRole
userRole} -> Maybe UserRole
userRole) (\s :: User
s@User' {} Maybe UserRole
a -> User
s {$sel:userRole:User' :: Maybe UserRole
userRole = Maybe UserRole
a} :: User)
user_enabledDate :: Lens.Lens' User (Prelude.Maybe Prelude.UTCTime)
user_enabledDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> User -> f User
user_enabledDate = (User -> Maybe POSIX)
-> (User -> Maybe POSIX -> User)
-> Lens User User (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe POSIX
enabledDate :: Maybe POSIX
$sel:enabledDate:User' :: User -> Maybe POSIX
enabledDate} -> Maybe POSIX
enabledDate) (\s :: User
s@User' {} Maybe POSIX
a -> User
s {$sel:enabledDate:User' :: Maybe POSIX
enabledDate = Maybe POSIX
a} :: User) ((Maybe POSIX -> f (Maybe POSIX)) -> User -> f User)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> User
-> f User
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromJSON User where
parseJSON :: Value -> Parser User
parseJSON =
String -> (Object -> Parser User) -> Value -> Parser User
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"User"
( \Object
x ->
Maybe Text
-> Maybe EntityState
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe UserRole
-> Maybe POSIX
-> User
User'
(Maybe Text
-> Maybe EntityState
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe UserRole
-> Maybe POSIX
-> User)
-> Parser (Maybe Text)
-> Parser
(Maybe EntityState
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe UserRole
-> Maybe POSIX
-> User)
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
"Email")
Parser
(Maybe EntityState
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe UserRole
-> Maybe POSIX
-> User)
-> Parser (Maybe EntityState)
-> Parser
(Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe UserRole
-> Maybe POSIX
-> User)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EntityState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
Parser
(Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe UserRole
-> Maybe POSIX
-> User)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe UserRole
-> Maybe POSIX
-> User)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DisabledDate")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe UserRole
-> Maybe POSIX
-> User)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> Maybe UserRole -> Maybe POSIX -> User)
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
"Name")
Parser
(Maybe Text -> Maybe Text -> Maybe UserRole -> Maybe POSIX -> User)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe UserRole -> Maybe POSIX -> User)
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 -> Maybe UserRole -> Maybe POSIX -> User)
-> Parser (Maybe Text)
-> Parser (Maybe UserRole -> Maybe POSIX -> User)
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
"DisplayName")
Parser (Maybe UserRole -> Maybe POSIX -> User)
-> Parser (Maybe UserRole) -> Parser (Maybe POSIX -> User)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UserRole)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserRole")
Parser (Maybe POSIX -> User) -> Parser (Maybe POSIX) -> Parser User
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EnabledDate")
)
instance Prelude.Hashable User
instance Prelude.NFData User