module TD.Query.InviteGroupCallParticipant
  (InviteGroupCallParticipant(..)
  , defaultInviteGroupCallParticipant
  ) where

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

-- | Invites a user to an active group call; for group calls not bound to a chat only. Sends a service message of the type messageGroupCall. The group call can have at most getOption("group_call_participant_count_max") participants. Returns 'TD.Data.InviteGroupCallParticipantResult.InviteGroupCallParticipantResult'
data InviteGroupCallParticipant
  = InviteGroupCallParticipant
    { InviteGroupCallParticipant -> Maybe Int
group_call_id :: Maybe Int  -- ^ Group call identifier
    , InviteGroupCallParticipant -> Maybe Int
user_id       :: Maybe Int  -- ^ User identifier
    , InviteGroupCallParticipant -> Maybe Bool
is_video      :: Maybe Bool -- ^ Pass true if the group call is a video call
    }
  deriving (InviteGroupCallParticipant -> InviteGroupCallParticipant -> Bool
(InviteGroupCallParticipant -> InviteGroupCallParticipant -> Bool)
-> (InviteGroupCallParticipant
    -> InviteGroupCallParticipant -> Bool)
-> Eq InviteGroupCallParticipant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InviteGroupCallParticipant -> InviteGroupCallParticipant -> Bool
== :: InviteGroupCallParticipant -> InviteGroupCallParticipant -> Bool
$c/= :: InviteGroupCallParticipant -> InviteGroupCallParticipant -> Bool
/= :: InviteGroupCallParticipant -> InviteGroupCallParticipant -> Bool
Eq, Int -> InviteGroupCallParticipant -> ShowS
[InviteGroupCallParticipant] -> ShowS
InviteGroupCallParticipant -> String
(Int -> InviteGroupCallParticipant -> ShowS)
-> (InviteGroupCallParticipant -> String)
-> ([InviteGroupCallParticipant] -> ShowS)
-> Show InviteGroupCallParticipant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InviteGroupCallParticipant -> ShowS
showsPrec :: Int -> InviteGroupCallParticipant -> ShowS
$cshow :: InviteGroupCallParticipant -> String
show :: InviteGroupCallParticipant -> String
$cshowList :: [InviteGroupCallParticipant] -> ShowS
showList :: [InviteGroupCallParticipant] -> ShowS
Show)

instance I.ShortShow InviteGroupCallParticipant where
  shortShow :: InviteGroupCallParticipant -> String
shortShow
    InviteGroupCallParticipant
      { group_call_id :: InviteGroupCallParticipant -> Maybe Int
group_call_id = Maybe Int
group_call_id_
      , user_id :: InviteGroupCallParticipant -> Maybe Int
user_id       = Maybe Int
user_id_
      , is_video :: InviteGroupCallParticipant -> Maybe Bool
is_video      = Maybe Bool
is_video_
      }
        = String
"InviteGroupCallParticipant"
          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
"user_id"       String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
          , String
"is_video"      String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_video_
          ]

instance AT.ToJSON InviteGroupCallParticipant where
  toJSON :: InviteGroupCallParticipant -> Value
toJSON
    InviteGroupCallParticipant
      { group_call_id :: InviteGroupCallParticipant -> Maybe Int
group_call_id = Maybe Int
group_call_id_
      , user_id :: InviteGroupCallParticipant -> Maybe Int
user_id       = Maybe Int
user_id_
      , is_video :: InviteGroupCallParticipant -> Maybe Bool
is_video      = Maybe Bool
is_video_
      }
        = [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
"inviteGroupCallParticipant"
          , 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
"user_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
user_id_
          , Key
"is_video"      Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_video_
          ]

defaultInviteGroupCallParticipant :: InviteGroupCallParticipant
defaultInviteGroupCallParticipant :: InviteGroupCallParticipant
defaultInviteGroupCallParticipant =
  InviteGroupCallParticipant
    { group_call_id :: Maybe Int
group_call_id = Maybe Int
forall a. Maybe a
Nothing
    , user_id :: Maybe Int
user_id       = Maybe Int
forall a. Maybe a
Nothing
    , is_video :: Maybe Bool
is_video      = Maybe Bool
forall a. Maybe a
Nothing
    }