module TD.Query.GetChatListsToAddChat
  (GetChatListsToAddChat(..)
  ) where

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

-- | Returns chat lists to which the chat can be added. This is an offline request. Returns 'TD.Data.ChatLists.ChatLists'
data GetChatListsToAddChat
  = GetChatListsToAddChat
    { GetChatListsToAddChat -> Maybe Int
chat_id :: Maybe Int -- ^ Chat identifier
    }
  deriving (GetChatListsToAddChat -> GetChatListsToAddChat -> Bool
(GetChatListsToAddChat -> GetChatListsToAddChat -> Bool)
-> (GetChatListsToAddChat -> GetChatListsToAddChat -> Bool)
-> Eq GetChatListsToAddChat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatListsToAddChat -> GetChatListsToAddChat -> Bool
== :: GetChatListsToAddChat -> GetChatListsToAddChat -> Bool
$c/= :: GetChatListsToAddChat -> GetChatListsToAddChat -> Bool
/= :: GetChatListsToAddChat -> GetChatListsToAddChat -> Bool
Eq, Int -> GetChatListsToAddChat -> ShowS
[GetChatListsToAddChat] -> ShowS
GetChatListsToAddChat -> String
(Int -> GetChatListsToAddChat -> ShowS)
-> (GetChatListsToAddChat -> String)
-> ([GetChatListsToAddChat] -> ShowS)
-> Show GetChatListsToAddChat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatListsToAddChat -> ShowS
showsPrec :: Int -> GetChatListsToAddChat -> ShowS
$cshow :: GetChatListsToAddChat -> String
show :: GetChatListsToAddChat -> String
$cshowList :: [GetChatListsToAddChat] -> ShowS
showList :: [GetChatListsToAddChat] -> ShowS
Show)

instance I.ShortShow GetChatListsToAddChat where
  shortShow :: GetChatListsToAddChat -> String
shortShow
    GetChatListsToAddChat
      { chat_id :: GetChatListsToAddChat -> Maybe Int
chat_id = Maybe Int
chat_id_
      }
        = String
"GetChatListsToAddChat"
          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_
          ]

instance AT.ToJSON GetChatListsToAddChat where
  toJSON :: GetChatListsToAddChat -> Value
toJSON
    GetChatListsToAddChat
      { chat_id :: GetChatListsToAddChat -> Maybe Int
chat_id = Maybe Int
chat_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
"getChatListsToAddChat"
          , 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_
          ]