module TD.Query.GetForumTopic
  (GetForumTopic(..)
  , defaultGetForumTopic
  ) where

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

-- | Returns information about a forum topic. Returns 'TD.Data.ForumTopic.ForumTopic'
data GetForumTopic
  = GetForumTopic
    { GetForumTopic -> Maybe Int
chat_id           :: Maybe Int -- ^ Identifier of the chat
    , GetForumTopic -> Maybe Int
message_thread_id :: Maybe Int -- ^ Message thread identifier of the forum topic
    }
  deriving (GetForumTopic -> GetForumTopic -> Bool
(GetForumTopic -> GetForumTopic -> Bool)
-> (GetForumTopic -> GetForumTopic -> Bool) -> Eq GetForumTopic
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetForumTopic -> GetForumTopic -> Bool
== :: GetForumTopic -> GetForumTopic -> Bool
$c/= :: GetForumTopic -> GetForumTopic -> Bool
/= :: GetForumTopic -> GetForumTopic -> Bool
Eq, Int -> GetForumTopic -> ShowS
[GetForumTopic] -> ShowS
GetForumTopic -> String
(Int -> GetForumTopic -> ShowS)
-> (GetForumTopic -> String)
-> ([GetForumTopic] -> ShowS)
-> Show GetForumTopic
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetForumTopic -> ShowS
showsPrec :: Int -> GetForumTopic -> ShowS
$cshow :: GetForumTopic -> String
show :: GetForumTopic -> String
$cshowList :: [GetForumTopic] -> ShowS
showList :: [GetForumTopic] -> ShowS
Show)

instance I.ShortShow GetForumTopic where
  shortShow :: GetForumTopic -> String
shortShow
    GetForumTopic
      { chat_id :: GetForumTopic -> Maybe Int
chat_id           = Maybe Int
chat_id_
      , message_thread_id :: GetForumTopic -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
      }
        = String
"GetForumTopic"
          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
"message_thread_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_thread_id_
          ]

instance AT.ToJSON GetForumTopic where
  toJSON :: GetForumTopic -> Value
toJSON
    GetForumTopic
      { chat_id :: GetForumTopic -> Maybe Int
chat_id           = Maybe Int
chat_id_
      , message_thread_id :: GetForumTopic -> Maybe Int
message_thread_id = Maybe Int
message_thread_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
"getForumTopic"
          , 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
"message_thread_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
message_thread_id_
          ]

defaultGetForumTopic :: GetForumTopic
defaultGetForumTopic :: GetForumTopic
defaultGetForumTopic =
  GetForumTopic
    { chat_id :: Maybe Int
chat_id           = Maybe Int
forall a. Maybe a
Nothing
    , message_thread_id :: Maybe Int
message_thread_id = Maybe Int
forall a. Maybe a
Nothing
    }