module TD.Query.GetChatAdministrators
  (GetChatAdministrators(..)
  ) where

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

-- | Returns a list of administrators of the chat with their custom titles. Returns 'TD.Data.ChatAdministrators.ChatAdministrators'
data GetChatAdministrators
  = GetChatAdministrators
    { GetChatAdministrators -> Maybe Int
chat_id :: Maybe Int -- ^ Chat identifier
    }
  deriving (GetChatAdministrators -> GetChatAdministrators -> Bool
(GetChatAdministrators -> GetChatAdministrators -> Bool)
-> (GetChatAdministrators -> GetChatAdministrators -> Bool)
-> Eq GetChatAdministrators
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatAdministrators -> GetChatAdministrators -> Bool
== :: GetChatAdministrators -> GetChatAdministrators -> Bool
$c/= :: GetChatAdministrators -> GetChatAdministrators -> Bool
/= :: GetChatAdministrators -> GetChatAdministrators -> Bool
Eq, Int -> GetChatAdministrators -> ShowS
[GetChatAdministrators] -> ShowS
GetChatAdministrators -> String
(Int -> GetChatAdministrators -> ShowS)
-> (GetChatAdministrators -> String)
-> ([GetChatAdministrators] -> ShowS)
-> Show GetChatAdministrators
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatAdministrators -> ShowS
showsPrec :: Int -> GetChatAdministrators -> ShowS
$cshow :: GetChatAdministrators -> String
show :: GetChatAdministrators -> String
$cshowList :: [GetChatAdministrators] -> ShowS
showList :: [GetChatAdministrators] -> ShowS
Show)

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