module TD.Query.SetVideoChatDefaultParticipant
  (SetVideoChatDefaultParticipant(..)
  , defaultSetVideoChatDefaultParticipant
  ) 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.MessageSender as MessageSender

-- | Changes default participant identifier, on whose behalf a video chat in the chat will be joined. Returns 'TD.Data.Ok.Ok'
data SetVideoChatDefaultParticipant
  = SetVideoChatDefaultParticipant
    { SetVideoChatDefaultParticipant -> Maybe Int
chat_id                :: Maybe Int                         -- ^ Chat identifier
    , SetVideoChatDefaultParticipant -> Maybe MessageSender
default_participant_id :: Maybe MessageSender.MessageSender -- ^ Default group call participant identifier to join the video chats
    }
  deriving (SetVideoChatDefaultParticipant
-> SetVideoChatDefaultParticipant -> Bool
(SetVideoChatDefaultParticipant
 -> SetVideoChatDefaultParticipant -> Bool)
-> (SetVideoChatDefaultParticipant
    -> SetVideoChatDefaultParticipant -> Bool)
-> Eq SetVideoChatDefaultParticipant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetVideoChatDefaultParticipant
-> SetVideoChatDefaultParticipant -> Bool
== :: SetVideoChatDefaultParticipant
-> SetVideoChatDefaultParticipant -> Bool
$c/= :: SetVideoChatDefaultParticipant
-> SetVideoChatDefaultParticipant -> Bool
/= :: SetVideoChatDefaultParticipant
-> SetVideoChatDefaultParticipant -> Bool
Eq, Int -> SetVideoChatDefaultParticipant -> ShowS
[SetVideoChatDefaultParticipant] -> ShowS
SetVideoChatDefaultParticipant -> String
(Int -> SetVideoChatDefaultParticipant -> ShowS)
-> (SetVideoChatDefaultParticipant -> String)
-> ([SetVideoChatDefaultParticipant] -> ShowS)
-> Show SetVideoChatDefaultParticipant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetVideoChatDefaultParticipant -> ShowS
showsPrec :: Int -> SetVideoChatDefaultParticipant -> ShowS
$cshow :: SetVideoChatDefaultParticipant -> String
show :: SetVideoChatDefaultParticipant -> String
$cshowList :: [SetVideoChatDefaultParticipant] -> ShowS
showList :: [SetVideoChatDefaultParticipant] -> ShowS
Show)

instance I.ShortShow SetVideoChatDefaultParticipant where
  shortShow :: SetVideoChatDefaultParticipant -> String
shortShow
    SetVideoChatDefaultParticipant
      { chat_id :: SetVideoChatDefaultParticipant -> Maybe Int
chat_id                = Maybe Int
chat_id_
      , default_participant_id :: SetVideoChatDefaultParticipant -> Maybe MessageSender
default_participant_id = Maybe MessageSender
default_participant_id_
      }
        = String
"SetVideoChatDefaultParticipant"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id"                String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"default_participant_id" String -> Maybe MessageSender -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSender
default_participant_id_
          ]

instance AT.ToJSON SetVideoChatDefaultParticipant where
  toJSON :: SetVideoChatDefaultParticipant -> Value
toJSON
    SetVideoChatDefaultParticipant
      { chat_id :: SetVideoChatDefaultParticipant -> Maybe Int
chat_id                = Maybe Int
chat_id_
      , default_participant_id :: SetVideoChatDefaultParticipant -> Maybe MessageSender
default_participant_id = Maybe MessageSender
default_participant_id_
      }
        = [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
"setVideoChatDefaultParticipant"
          , Key
"chat_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
chat_id_
          , Key
"default_participant_id" Key -> Maybe MessageSender -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe MessageSender
default_participant_id_
          ]

defaultSetVideoChatDefaultParticipant :: SetVideoChatDefaultParticipant
defaultSetVideoChatDefaultParticipant :: SetVideoChatDefaultParticipant
defaultSetVideoChatDefaultParticipant =
  SetVideoChatDefaultParticipant
    { chat_id :: Maybe Int
chat_id                = Maybe Int
forall a. Maybe a
Nothing
    , default_participant_id :: Maybe MessageSender
default_participant_id = Maybe MessageSender
forall a. Maybe a
Nothing
    }