module TD.Query.GetInlineGameHighScores
  (GetInlineGameHighScores(..)
  , defaultGetInlineGameHighScores
  ) where

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

-- | Returns game high scores and some part of the high score table in the range of the specified user; for bots only. Returns 'TD.Data.GameHighScores.GameHighScores'
data GetInlineGameHighScores
  = GetInlineGameHighScores
    { GetInlineGameHighScores -> Maybe Text
inline_message_id :: Maybe T.Text -- ^ Inline message identifier
    , GetInlineGameHighScores -> Maybe Int
user_id           :: Maybe Int    -- ^ User identifier
    }
  deriving (GetInlineGameHighScores -> GetInlineGameHighScores -> Bool
(GetInlineGameHighScores -> GetInlineGameHighScores -> Bool)
-> (GetInlineGameHighScores -> GetInlineGameHighScores -> Bool)
-> Eq GetInlineGameHighScores
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetInlineGameHighScores -> GetInlineGameHighScores -> Bool
== :: GetInlineGameHighScores -> GetInlineGameHighScores -> Bool
$c/= :: GetInlineGameHighScores -> GetInlineGameHighScores -> Bool
/= :: GetInlineGameHighScores -> GetInlineGameHighScores -> Bool
Eq, Int -> GetInlineGameHighScores -> ShowS
[GetInlineGameHighScores] -> ShowS
GetInlineGameHighScores -> String
(Int -> GetInlineGameHighScores -> ShowS)
-> (GetInlineGameHighScores -> String)
-> ([GetInlineGameHighScores] -> ShowS)
-> Show GetInlineGameHighScores
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetInlineGameHighScores -> ShowS
showsPrec :: Int -> GetInlineGameHighScores -> ShowS
$cshow :: GetInlineGameHighScores -> String
show :: GetInlineGameHighScores -> String
$cshowList :: [GetInlineGameHighScores] -> ShowS
showList :: [GetInlineGameHighScores] -> ShowS
Show)

instance I.ShortShow GetInlineGameHighScores where
  shortShow :: GetInlineGameHighScores -> String
shortShow
    GetInlineGameHighScores
      { inline_message_id :: GetInlineGameHighScores -> Maybe Text
inline_message_id = Maybe Text
inline_message_id_
      , user_id :: GetInlineGameHighScores -> Maybe Int
user_id           = Maybe Int
user_id_
      }
        = String
"GetInlineGameHighScores"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"inline_message_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
inline_message_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 GetInlineGameHighScores where
  toJSON :: GetInlineGameHighScores -> Value
toJSON
    GetInlineGameHighScores
      { inline_message_id :: GetInlineGameHighScores -> Maybe Text
inline_message_id = Maybe Text
inline_message_id_
      , user_id :: GetInlineGameHighScores -> 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
"getInlineGameHighScores"
          , Key
"inline_message_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
inline_message_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_
          ]

defaultGetInlineGameHighScores :: GetInlineGameHighScores
defaultGetInlineGameHighScores :: GetInlineGameHighScores
defaultGetInlineGameHighScores =
  GetInlineGameHighScores
    { inline_message_id :: Maybe Text
inline_message_id = Maybe Text
forall a. Maybe a
Nothing
    , user_id :: Maybe Int
user_id           = Maybe Int
forall a. Maybe a
Nothing
    }