syntax = "v1"

import "common.api"

type (
	Game {
		Id       int64  `json:"id,optional"`
		Name     string `json:"name"`
		Icon     string `json:"icon"`
		Category string `json:"category"`
	}
	GameListResp {
		Items []Game   `json:"items"`
		Meta  PageMeta `json:"meta"`
	}
	GetGameReq {
		Id int64 `path:"id"`
	}
)

@server (
	prefix: api/v1/games
	group:  game
)
service game-api {
	@doc "获取游戏列表"
	@handler ListGames
	get / (PageReq) returns (GameListResp)

	@doc "获取游戏详情"
	@handler GetGame
	get /:id (GetGameReq) returns (Game)

	@doc "创建游戏"
	@handler CreateGame
	post / (Game) returns (Game)
}

