module TD.Query.GetChatFolder
  (GetChatFolder(..)
  ) 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 chat folder by its identifier. Returns 'TD.Data.ChatFolder.ChatFolder'
data GetChatFolder
  = GetChatFolder
    { GetChatFolder -> Maybe Int
chat_folder_id :: Maybe Int -- ^ Chat folder identifier
    }
  deriving (GetChatFolder -> GetChatFolder -> Bool
(GetChatFolder -> GetChatFolder -> Bool)
-> (GetChatFolder -> GetChatFolder -> Bool) -> Eq GetChatFolder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatFolder -> GetChatFolder -> Bool
== :: GetChatFolder -> GetChatFolder -> Bool
$c/= :: GetChatFolder -> GetChatFolder -> Bool
/= :: GetChatFolder -> GetChatFolder -> Bool
Eq, Int -> GetChatFolder -> ShowS
[GetChatFolder] -> ShowS
GetChatFolder -> String
(Int -> GetChatFolder -> ShowS)
-> (GetChatFolder -> String)
-> ([GetChatFolder] -> ShowS)
-> Show GetChatFolder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatFolder -> ShowS
showsPrec :: Int -> GetChatFolder -> ShowS
$cshow :: GetChatFolder -> String
show :: GetChatFolder -> String
$cshowList :: [GetChatFolder] -> ShowS
showList :: [GetChatFolder] -> ShowS
Show)

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

instance AT.ToJSON GetChatFolder where
  toJSON :: GetChatFolder -> Value
toJSON
    GetChatFolder
      { chat_folder_id :: GetChatFolder -> Maybe Int
chat_folder_id = Maybe Int
chat_folder_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
"getChatFolder"
          , Key
"chat_folder_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_folder_id_
          ]