module TD.Query.GetGroupCallParticipants
  (GetGroupCallParticipants(..)
  , defaultGetGroupCallParticipants
  ) 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.InputGroupCall as InputGroupCall

-- | Returns information about participants of a non-joined group call that is not bound to a chat. Returns 'TD.Data.GroupCallParticipants.GroupCallParticipants'
data GetGroupCallParticipants
  = GetGroupCallParticipants
    { GetGroupCallParticipants -> Maybe InputGroupCall
input_group_call :: Maybe InputGroupCall.InputGroupCall -- ^ The group call which participants will be returned
    , GetGroupCallParticipants -> Maybe Int
limit            :: Maybe Int                           -- ^ The maximum number of participants to return; must be positive
    }
  deriving (GetGroupCallParticipants -> GetGroupCallParticipants -> Bool
(GetGroupCallParticipants -> GetGroupCallParticipants -> Bool)
-> (GetGroupCallParticipants -> GetGroupCallParticipants -> Bool)
-> Eq GetGroupCallParticipants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetGroupCallParticipants -> GetGroupCallParticipants -> Bool
== :: GetGroupCallParticipants -> GetGroupCallParticipants -> Bool
$c/= :: GetGroupCallParticipants -> GetGroupCallParticipants -> Bool
/= :: GetGroupCallParticipants -> GetGroupCallParticipants -> Bool
Eq, Int -> GetGroupCallParticipants -> ShowS
[GetGroupCallParticipants] -> ShowS
GetGroupCallParticipants -> String
(Int -> GetGroupCallParticipants -> ShowS)
-> (GetGroupCallParticipants -> String)
-> ([GetGroupCallParticipants] -> ShowS)
-> Show GetGroupCallParticipants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetGroupCallParticipants -> ShowS
showsPrec :: Int -> GetGroupCallParticipants -> ShowS
$cshow :: GetGroupCallParticipants -> String
show :: GetGroupCallParticipants -> String
$cshowList :: [GetGroupCallParticipants] -> ShowS
showList :: [GetGroupCallParticipants] -> ShowS
Show)

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

instance AT.ToJSON GetGroupCallParticipants where
  toJSON :: GetGroupCallParticipants -> Value
toJSON
    GetGroupCallParticipants
      { input_group_call :: GetGroupCallParticipants -> Maybe InputGroupCall
input_group_call = Maybe InputGroupCall
input_group_call_
      , limit :: GetGroupCallParticipants -> 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
"getGroupCallParticipants"
          , Key
"input_group_call" Key -> Maybe InputGroupCall -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputGroupCall
input_group_call_
          , 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_
          ]

defaultGetGroupCallParticipants :: GetGroupCallParticipants
defaultGetGroupCallParticipants :: GetGroupCallParticipants
defaultGetGroupCallParticipants =
  GetGroupCallParticipants
    { input_group_call :: Maybe InputGroupCall
input_group_call = Maybe InputGroupCall
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit            = Maybe Int
forall a. Maybe a
Nothing
    }