module TD.Query.SendCallDebugInformation
  (SendCallDebugInformation(..)
  , defaultSendCallDebugInformation
  ) where

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

-- | Sends debug information for a call to Telegram servers. Returns 'TD.Data.Ok.Ok'
data SendCallDebugInformation
  = SendCallDebugInformation
    { SendCallDebugInformation -> Maybe Int
call_id           :: Maybe Int    -- ^ Call identifier
    , SendCallDebugInformation -> Maybe Text
debug_information :: Maybe T.Text -- ^ Debug information in application-specific format
    }
  deriving (SendCallDebugInformation -> SendCallDebugInformation -> Bool
(SendCallDebugInformation -> SendCallDebugInformation -> Bool)
-> (SendCallDebugInformation -> SendCallDebugInformation -> Bool)
-> Eq SendCallDebugInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendCallDebugInformation -> SendCallDebugInformation -> Bool
== :: SendCallDebugInformation -> SendCallDebugInformation -> Bool
$c/= :: SendCallDebugInformation -> SendCallDebugInformation -> Bool
/= :: SendCallDebugInformation -> SendCallDebugInformation -> Bool
Eq, Int -> SendCallDebugInformation -> ShowS
[SendCallDebugInformation] -> ShowS
SendCallDebugInformation -> String
(Int -> SendCallDebugInformation -> ShowS)
-> (SendCallDebugInformation -> String)
-> ([SendCallDebugInformation] -> ShowS)
-> Show SendCallDebugInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendCallDebugInformation -> ShowS
showsPrec :: Int -> SendCallDebugInformation -> ShowS
$cshow :: SendCallDebugInformation -> String
show :: SendCallDebugInformation -> String
$cshowList :: [SendCallDebugInformation] -> ShowS
showList :: [SendCallDebugInformation] -> ShowS
Show)

instance I.ShortShow SendCallDebugInformation where
  shortShow :: SendCallDebugInformation -> String
shortShow
    SendCallDebugInformation
      { call_id :: SendCallDebugInformation -> Maybe Int
call_id           = Maybe Int
call_id_
      , debug_information :: SendCallDebugInformation -> Maybe Text
debug_information = Maybe Text
debug_information_
      }
        = String
"SendCallDebugInformation"
          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_
          , String
"debug_information" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
debug_information_
          ]

instance AT.ToJSON SendCallDebugInformation where
  toJSON :: SendCallDebugInformation -> Value
toJSON
    SendCallDebugInformation
      { call_id :: SendCallDebugInformation -> Maybe Int
call_id           = Maybe Int
call_id_
      , debug_information :: SendCallDebugInformation -> Maybe Text
debug_information = Maybe Text
debug_information_
      }
        = [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
"sendCallDebugInformation"
          , 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_
          , Key
"debug_information" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
debug_information_
          ]

defaultSendCallDebugInformation :: SendCallDebugInformation
defaultSendCallDebugInformation :: SendCallDebugInformation
defaultSendCallDebugInformation =
  SendCallDebugInformation
    { call_id :: Maybe Int
call_id           = Maybe Int
forall a. Maybe a
Nothing
    , debug_information :: Maybe Text
debug_information = Maybe Text
forall a. Maybe a
Nothing
    }