{-# 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.Delegate where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkMail.Types.MemberType
data Delegate = Delegate'
{
Delegate -> Text
id :: Prelude.Text,
Delegate -> MemberType
type' :: MemberType
}
deriving (Delegate -> Delegate -> Bool
(Delegate -> Delegate -> Bool)
-> (Delegate -> Delegate -> Bool) -> Eq Delegate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Delegate -> Delegate -> Bool
$c/= :: Delegate -> Delegate -> Bool
== :: Delegate -> Delegate -> Bool
$c== :: Delegate -> Delegate -> Bool
Prelude.Eq, ReadPrec [Delegate]
ReadPrec Delegate
Int -> ReadS Delegate
ReadS [Delegate]
(Int -> ReadS Delegate)
-> ReadS [Delegate]
-> ReadPrec Delegate
-> ReadPrec [Delegate]
-> Read Delegate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Delegate]
$creadListPrec :: ReadPrec [Delegate]
readPrec :: ReadPrec Delegate
$creadPrec :: ReadPrec Delegate
readList :: ReadS [Delegate]
$creadList :: ReadS [Delegate]
readsPrec :: Int -> ReadS Delegate
$creadsPrec :: Int -> ReadS Delegate
Prelude.Read, Int -> Delegate -> ShowS
[Delegate] -> ShowS
Delegate -> String
(Int -> Delegate -> ShowS)
-> (Delegate -> String) -> ([Delegate] -> ShowS) -> Show Delegate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Delegate] -> ShowS
$cshowList :: [Delegate] -> ShowS
show :: Delegate -> String
$cshow :: Delegate -> String
showsPrec :: Int -> Delegate -> ShowS
$cshowsPrec :: Int -> Delegate -> ShowS
Prelude.Show, (forall x. Delegate -> Rep Delegate x)
-> (forall x. Rep Delegate x -> Delegate) -> Generic Delegate
forall x. Rep Delegate x -> Delegate
forall x. Delegate -> Rep Delegate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Delegate x -> Delegate
$cfrom :: forall x. Delegate -> Rep Delegate x
Prelude.Generic)
newDelegate ::
Prelude.Text ->
MemberType ->
Delegate
newDelegate :: Text -> MemberType -> Delegate
newDelegate Text
pId_ MemberType
pType_ =
Delegate' :: Text -> MemberType -> Delegate
Delegate' {$sel:id:Delegate' :: Text
id = Text
pId_, $sel:type':Delegate' :: MemberType
type' = MemberType
pType_}
delegate_id :: Lens.Lens' Delegate Prelude.Text
delegate_id :: (Text -> f Text) -> Delegate -> f Delegate
delegate_id = (Delegate -> Text)
-> (Delegate -> Text -> Delegate)
-> Lens Delegate Delegate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Delegate' {Text
id :: Text
$sel:id:Delegate' :: Delegate -> Text
id} -> Text
id) (\s :: Delegate
s@Delegate' {} Text
a -> Delegate
s {$sel:id:Delegate' :: Text
id = Text
a} :: Delegate)
delegate_type :: Lens.Lens' Delegate MemberType
delegate_type :: (MemberType -> f MemberType) -> Delegate -> f Delegate
delegate_type = (Delegate -> MemberType)
-> (Delegate -> MemberType -> Delegate)
-> Lens Delegate Delegate MemberType MemberType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Delegate' {MemberType
type' :: MemberType
$sel:type':Delegate' :: Delegate -> MemberType
type'} -> MemberType
type') (\s :: Delegate
s@Delegate' {} MemberType
a -> Delegate
s {$sel:type':Delegate' :: MemberType
type' = MemberType
a} :: Delegate)
instance Core.FromJSON Delegate where
parseJSON :: Value -> Parser Delegate
parseJSON =
String -> (Object -> Parser Delegate) -> Value -> Parser Delegate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Delegate"
( \Object
x ->
Text -> MemberType -> Delegate
Delegate'
(Text -> MemberType -> Delegate)
-> Parser Text -> Parser (MemberType -> Delegate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Id") Parser (MemberType -> Delegate)
-> Parser MemberType -> Parser Delegate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser MemberType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
)
instance Prelude.Hashable Delegate
instance Prelude.NFData Delegate