module TD.Query.GetUserChatBoosts
  (GetUserChatBoosts(..)
  , defaultGetUserChatBoosts
  ) where

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

-- | Returns the list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only. Returns 'TD.Data.FoundChatBoosts.FoundChatBoosts'
data GetUserChatBoosts
  = GetUserChatBoosts
    { GetUserChatBoosts -> Maybe Int
chat_id :: Maybe Int -- ^ Identifier of the chat
    , GetUserChatBoosts -> Maybe Int
user_id :: Maybe Int -- ^ Identifier of the user
    }
  deriving (GetUserChatBoosts -> GetUserChatBoosts -> Bool
(GetUserChatBoosts -> GetUserChatBoosts -> Bool)
-> (GetUserChatBoosts -> GetUserChatBoosts -> Bool)
-> Eq GetUserChatBoosts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetUserChatBoosts -> GetUserChatBoosts -> Bool
== :: GetUserChatBoosts -> GetUserChatBoosts -> Bool
$c/= :: GetUserChatBoosts -> GetUserChatBoosts -> Bool
/= :: GetUserChatBoosts -> GetUserChatBoosts -> Bool
Eq, Int -> GetUserChatBoosts -> ShowS
[GetUserChatBoosts] -> ShowS
GetUserChatBoosts -> String
(Int -> GetUserChatBoosts -> ShowS)
-> (GetUserChatBoosts -> String)
-> ([GetUserChatBoosts] -> ShowS)
-> Show GetUserChatBoosts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetUserChatBoosts -> ShowS
showsPrec :: Int -> GetUserChatBoosts -> ShowS
$cshow :: GetUserChatBoosts -> String
show :: GetUserChatBoosts -> String
$cshowList :: [GetUserChatBoosts] -> ShowS
showList :: [GetUserChatBoosts] -> ShowS
Show)

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

instance AT.ToJSON GetUserChatBoosts where
  toJSON :: GetUserChatBoosts -> Value
toJSON
    GetUserChatBoosts
      { chat_id :: GetUserChatBoosts -> Maybe Int
chat_id = Maybe Int
chat_id_
      , user_id :: GetUserChatBoosts -> Maybe Int
user_id = Maybe Int
user_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
"getUserChatBoosts"
          , 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
"user_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
user_id_
          ]

defaultGetUserChatBoosts :: GetUserChatBoosts
defaultGetUserChatBoosts :: GetUserChatBoosts
defaultGetUserChatBoosts =
  GetUserChatBoosts
    { chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
    , user_id :: Maybe Int
user_id = Maybe Int
forall a. Maybe a
Nothing
    }