module TD.Query.CreateGroupCall
  (CreateGroupCall(..)
  ) where

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

-- | Creates a group call from a one-to-one call. Returns 'TD.Data.Ok.Ok'
data CreateGroupCall
  = CreateGroupCall
    { CreateGroupCall -> Maybe Int
call_id :: Maybe Int -- ^ Call identifier
    }
  deriving (CreateGroupCall -> CreateGroupCall -> Bool
(CreateGroupCall -> CreateGroupCall -> Bool)
-> (CreateGroupCall -> CreateGroupCall -> Bool)
-> Eq CreateGroupCall
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateGroupCall -> CreateGroupCall -> Bool
== :: CreateGroupCall -> CreateGroupCall -> Bool
$c/= :: CreateGroupCall -> CreateGroupCall -> Bool
/= :: CreateGroupCall -> CreateGroupCall -> Bool
Eq, Int -> CreateGroupCall -> ShowS
[CreateGroupCall] -> ShowS
CreateGroupCall -> String
(Int -> CreateGroupCall -> ShowS)
-> (CreateGroupCall -> String)
-> ([CreateGroupCall] -> ShowS)
-> Show CreateGroupCall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateGroupCall -> ShowS
showsPrec :: Int -> CreateGroupCall -> ShowS
$cshow :: CreateGroupCall -> String
show :: CreateGroupCall -> String
$cshowList :: [CreateGroupCall] -> ShowS
showList :: [CreateGroupCall] -> ShowS
Show)

instance I.ShortShow CreateGroupCall where
  shortShow :: CreateGroupCall -> String
shortShow
    CreateGroupCall
      { call_id :: CreateGroupCall -> Maybe Int
call_id = Maybe Int
call_id_
      }
        = String
"CreateGroupCall"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"call_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
call_id_
          ]

instance AT.ToJSON CreateGroupCall where
  toJSON :: CreateGroupCall -> Value
toJSON
    CreateGroupCall
      { call_id :: CreateGroupCall -> Maybe Int
call_id = Maybe Int
call_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
"createGroupCall"
          , Key
"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
call_id_
          ]