module TD.Query.LoadGroupCallParticipants
  (LoadGroupCallParticipants(..)
  , defaultLoadGroupCallParticipants
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Loads more participants of a group call. The loaded participants will be received through updates. Use the field groupCall.loaded_all_participants to check whether all participants have already been loaded. Returns 'TD.Data.Ok.Ok'
data LoadGroupCallParticipants
  = LoadGroupCallParticipants
    { LoadGroupCallParticipants -> Maybe Int
group_call_id :: Maybe Int -- ^ Group call identifier. The group call must be previously received through getGroupCall and must be joined or being joined
    , LoadGroupCallParticipants -> Maybe Int
limit         :: Maybe Int -- ^ The maximum number of participants to load; up to 100
    }
  deriving (LoadGroupCallParticipants -> LoadGroupCallParticipants -> Bool
(LoadGroupCallParticipants -> LoadGroupCallParticipants -> Bool)
-> (LoadGroupCallParticipants -> LoadGroupCallParticipants -> Bool)
-> Eq LoadGroupCallParticipants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LoadGroupCallParticipants -> LoadGroupCallParticipants -> Bool
== :: LoadGroupCallParticipants -> LoadGroupCallParticipants -> Bool
$c/= :: LoadGroupCallParticipants -> LoadGroupCallParticipants -> Bool
/= :: LoadGroupCallParticipants -> LoadGroupCallParticipants -> Bool
Eq, Int -> LoadGroupCallParticipants -> ShowS
[LoadGroupCallParticipants] -> ShowS
LoadGroupCallParticipants -> String
(Int -> LoadGroupCallParticipants -> ShowS)
-> (LoadGroupCallParticipants -> String)
-> ([LoadGroupCallParticipants] -> ShowS)
-> Show LoadGroupCallParticipants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LoadGroupCallParticipants -> ShowS
showsPrec :: Int -> LoadGroupCallParticipants -> ShowS
$cshow :: LoadGroupCallParticipants -> String
show :: LoadGroupCallParticipants -> String
$cshowList :: [LoadGroupCallParticipants] -> ShowS
showList :: [LoadGroupCallParticipants] -> ShowS
Show)

instance I.ShortShow LoadGroupCallParticipants where
  shortShow :: LoadGroupCallParticipants -> String
shortShow
    LoadGroupCallParticipants
      { group_call_id :: LoadGroupCallParticipants -> Maybe Int
group_call_id = Maybe Int
group_call_id_
      , limit :: LoadGroupCallParticipants -> Maybe Int
limit         = Maybe Int
limit_
      }
        = String
"LoadGroupCallParticipants"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"group_call_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
group_call_id_
          , String
"limit"         String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
          ]

instance AT.ToJSON LoadGroupCallParticipants where
  toJSON :: LoadGroupCallParticipants -> Value
toJSON
    LoadGroupCallParticipants
      { group_call_id :: LoadGroupCallParticipants -> Maybe Int
group_call_id = Maybe Int
group_call_id_
      , limit :: LoadGroupCallParticipants -> Maybe Int
limit         = Maybe Int
limit_
      }
        = [Pair] -> Value
A.object
          [ Key
"@type"         Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"loadGroupCallParticipants"
          , Key
"group_call_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
group_call_id_
          , Key
"limit"         Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
limit_
          ]

defaultLoadGroupCallParticipants :: LoadGroupCallParticipants
defaultLoadGroupCallParticipants :: LoadGroupCallParticipants
defaultLoadGroupCallParticipants =
  LoadGroupCallParticipants
    { group_call_id :: Maybe Int
group_call_id = Maybe Int
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit         = Maybe Int
forall a. Maybe a
Nothing
    }