{-# 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.Chime.Types.MembershipItem where
import Amazonka.Chime.Types.RoomMembershipRole
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data MembershipItem = MembershipItem'
{
MembershipItem -> Maybe Text
memberId :: Prelude.Maybe Prelude.Text,
MembershipItem -> Maybe RoomMembershipRole
role' :: Prelude.Maybe RoomMembershipRole
}
deriving (MembershipItem -> MembershipItem -> Bool
(MembershipItem -> MembershipItem -> Bool)
-> (MembershipItem -> MembershipItem -> Bool) -> Eq MembershipItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MembershipItem -> MembershipItem -> Bool
$c/= :: MembershipItem -> MembershipItem -> Bool
== :: MembershipItem -> MembershipItem -> Bool
$c== :: MembershipItem -> MembershipItem -> Bool
Prelude.Eq, ReadPrec [MembershipItem]
ReadPrec MembershipItem
Int -> ReadS MembershipItem
ReadS [MembershipItem]
(Int -> ReadS MembershipItem)
-> ReadS [MembershipItem]
-> ReadPrec MembershipItem
-> ReadPrec [MembershipItem]
-> Read MembershipItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MembershipItem]
$creadListPrec :: ReadPrec [MembershipItem]
readPrec :: ReadPrec MembershipItem
$creadPrec :: ReadPrec MembershipItem
readList :: ReadS [MembershipItem]
$creadList :: ReadS [MembershipItem]
readsPrec :: Int -> ReadS MembershipItem
$creadsPrec :: Int -> ReadS MembershipItem
Prelude.Read, Int -> MembershipItem -> ShowS
[MembershipItem] -> ShowS
MembershipItem -> String
(Int -> MembershipItem -> ShowS)
-> (MembershipItem -> String)
-> ([MembershipItem] -> ShowS)
-> Show MembershipItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MembershipItem] -> ShowS
$cshowList :: [MembershipItem] -> ShowS
show :: MembershipItem -> String
$cshow :: MembershipItem -> String
showsPrec :: Int -> MembershipItem -> ShowS
$cshowsPrec :: Int -> MembershipItem -> ShowS
Prelude.Show, (forall x. MembershipItem -> Rep MembershipItem x)
-> (forall x. Rep MembershipItem x -> MembershipItem)
-> Generic MembershipItem
forall x. Rep MembershipItem x -> MembershipItem
forall x. MembershipItem -> Rep MembershipItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MembershipItem x -> MembershipItem
$cfrom :: forall x. MembershipItem -> Rep MembershipItem x
Prelude.Generic)
newMembershipItem ::
MembershipItem
newMembershipItem :: MembershipItem
newMembershipItem =
MembershipItem' :: Maybe Text -> Maybe RoomMembershipRole -> MembershipItem
MembershipItem'
{ $sel:memberId:MembershipItem' :: Maybe Text
memberId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:role':MembershipItem' :: Maybe RoomMembershipRole
role' = Maybe RoomMembershipRole
forall a. Maybe a
Prelude.Nothing
}
membershipItem_memberId :: Lens.Lens' MembershipItem (Prelude.Maybe Prelude.Text)
membershipItem_memberId :: (Maybe Text -> f (Maybe Text))
-> MembershipItem -> f MembershipItem
membershipItem_memberId = (MembershipItem -> Maybe Text)
-> (MembershipItem -> Maybe Text -> MembershipItem)
-> Lens MembershipItem MembershipItem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MembershipItem' {Maybe Text
memberId :: Maybe Text
$sel:memberId:MembershipItem' :: MembershipItem -> Maybe Text
memberId} -> Maybe Text
memberId) (\s :: MembershipItem
s@MembershipItem' {} Maybe Text
a -> MembershipItem
s {$sel:memberId:MembershipItem' :: Maybe Text
memberId = Maybe Text
a} :: MembershipItem)
membershipItem_role :: Lens.Lens' MembershipItem (Prelude.Maybe RoomMembershipRole)
membershipItem_role :: (Maybe RoomMembershipRole -> f (Maybe RoomMembershipRole))
-> MembershipItem -> f MembershipItem
membershipItem_role = (MembershipItem -> Maybe RoomMembershipRole)
-> (MembershipItem -> Maybe RoomMembershipRole -> MembershipItem)
-> Lens
MembershipItem
MembershipItem
(Maybe RoomMembershipRole)
(Maybe RoomMembershipRole)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MembershipItem' {Maybe RoomMembershipRole
role' :: Maybe RoomMembershipRole
$sel:role':MembershipItem' :: MembershipItem -> Maybe RoomMembershipRole
role'} -> Maybe RoomMembershipRole
role') (\s :: MembershipItem
s@MembershipItem' {} Maybe RoomMembershipRole
a -> MembershipItem
s {$sel:role':MembershipItem' :: Maybe RoomMembershipRole
role' = Maybe RoomMembershipRole
a} :: MembershipItem)
instance Prelude.Hashable MembershipItem
instance Prelude.NFData MembershipItem
instance Core.ToJSON MembershipItem where
toJSON :: MembershipItem -> Value
toJSON MembershipItem' {Maybe Text
Maybe RoomMembershipRole
role' :: Maybe RoomMembershipRole
memberId :: Maybe Text
$sel:role':MembershipItem' :: MembershipItem -> Maybe RoomMembershipRole
$sel:memberId:MembershipItem' :: MembershipItem -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MemberId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
memberId,
(Text
"Role" Text -> RoomMembershipRole -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RoomMembershipRole -> Pair)
-> Maybe RoomMembershipRole -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RoomMembershipRole
role'
]
)