module TD.Data.GroupCallParticipantVideoInfo
(GroupCallParticipantVideoInfo(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.GroupCallVideoSourceGroup as GroupCallVideoSourceGroup
import qualified Data.Text as T
data GroupCallParticipantVideoInfo
= GroupCallParticipantVideoInfo
{ GroupCallParticipantVideoInfo -> Maybe [GroupCallVideoSourceGroup]
source_groups :: Maybe [GroupCallVideoSourceGroup.GroupCallVideoSourceGroup]
, GroupCallParticipantVideoInfo -> Maybe Text
endpoint_id :: Maybe T.Text
, GroupCallParticipantVideoInfo -> Maybe Bool
is_paused :: Maybe Bool
}
deriving (GroupCallParticipantVideoInfo
-> GroupCallParticipantVideoInfo -> Bool
(GroupCallParticipantVideoInfo
-> GroupCallParticipantVideoInfo -> Bool)
-> (GroupCallParticipantVideoInfo
-> GroupCallParticipantVideoInfo -> Bool)
-> Eq GroupCallParticipantVideoInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroupCallParticipantVideoInfo
-> GroupCallParticipantVideoInfo -> Bool
== :: GroupCallParticipantVideoInfo
-> GroupCallParticipantVideoInfo -> Bool
$c/= :: GroupCallParticipantVideoInfo
-> GroupCallParticipantVideoInfo -> Bool
/= :: GroupCallParticipantVideoInfo
-> GroupCallParticipantVideoInfo -> Bool
Eq, Int -> GroupCallParticipantVideoInfo -> ShowS
[GroupCallParticipantVideoInfo] -> ShowS
GroupCallParticipantVideoInfo -> String
(Int -> GroupCallParticipantVideoInfo -> ShowS)
-> (GroupCallParticipantVideoInfo -> String)
-> ([GroupCallParticipantVideoInfo] -> ShowS)
-> Show GroupCallParticipantVideoInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroupCallParticipantVideoInfo -> ShowS
showsPrec :: Int -> GroupCallParticipantVideoInfo -> ShowS
$cshow :: GroupCallParticipantVideoInfo -> String
show :: GroupCallParticipantVideoInfo -> String
$cshowList :: [GroupCallParticipantVideoInfo] -> ShowS
showList :: [GroupCallParticipantVideoInfo] -> ShowS
Show)
instance I.ShortShow GroupCallParticipantVideoInfo where
shortShow :: GroupCallParticipantVideoInfo -> String
shortShow GroupCallParticipantVideoInfo
{ source_groups :: GroupCallParticipantVideoInfo -> Maybe [GroupCallVideoSourceGroup]
source_groups = Maybe [GroupCallVideoSourceGroup]
source_groups_
, endpoint_id :: GroupCallParticipantVideoInfo -> Maybe Text
endpoint_id = Maybe Text
endpoint_id_
, is_paused :: GroupCallParticipantVideoInfo -> Maybe Bool
is_paused = Maybe Bool
is_paused_
}
= String
"GroupCallParticipantVideoInfo"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"source_groups" String -> Maybe [GroupCallVideoSourceGroup] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [GroupCallVideoSourceGroup]
source_groups_
, String
"endpoint_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
endpoint_id_
, String
"is_paused" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_paused_
]
instance AT.FromJSON GroupCallParticipantVideoInfo where
parseJSON :: Value -> Parser GroupCallParticipantVideoInfo
parseJSON v :: Value
v@(AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"groupCallParticipantVideoInfo" -> Value -> Parser GroupCallParticipantVideoInfo
parseGroupCallParticipantVideoInfo Value
v
String
_ -> Parser GroupCallParticipantVideoInfo
forall a. Monoid a => a
mempty
where
parseGroupCallParticipantVideoInfo :: A.Value -> AT.Parser GroupCallParticipantVideoInfo
parseGroupCallParticipantVideoInfo :: Value -> Parser GroupCallParticipantVideoInfo
parseGroupCallParticipantVideoInfo = String
-> (Object -> Parser GroupCallParticipantVideoInfo)
-> Value
-> Parser GroupCallParticipantVideoInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"GroupCallParticipantVideoInfo" ((Object -> Parser GroupCallParticipantVideoInfo)
-> Value -> Parser GroupCallParticipantVideoInfo)
-> (Object -> Parser GroupCallParticipantVideoInfo)
-> Value
-> Parser GroupCallParticipantVideoInfo
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe [GroupCallVideoSourceGroup]
source_groups_ <- Object
o Object -> Key -> Parser (Maybe [GroupCallVideoSourceGroup])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"source_groups"
Maybe Text
endpoint_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"endpoint_id"
Maybe Bool
is_paused_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_paused"
GroupCallParticipantVideoInfo
-> Parser GroupCallParticipantVideoInfo
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (GroupCallParticipantVideoInfo
-> Parser GroupCallParticipantVideoInfo)
-> GroupCallParticipantVideoInfo
-> Parser GroupCallParticipantVideoInfo
forall a b. (a -> b) -> a -> b
$ GroupCallParticipantVideoInfo
{ source_groups :: Maybe [GroupCallVideoSourceGroup]
source_groups = Maybe [GroupCallVideoSourceGroup]
source_groups_
, endpoint_id :: Maybe Text
endpoint_id = Maybe Text
endpoint_id_
, is_paused :: Maybe Bool
is_paused = Maybe Bool
is_paused_
}
parseJSON Value
_ = Parser GroupCallParticipantVideoInfo
forall a. Monoid a => a
mempty