// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.3

package handler

import (
	"net/http"

	room "microGame/app/usercenter/cmd/api/internal/handler/room"
	user "microGame/app/usercenter/cmd/api/internal/handler/user"
	"microGame/app/usercenter/cmd/api/internal/svc"

	"github.com/zeromicro/go-zero/rest"
)

func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
	server.AddRoutes(
		[]rest.Route{
			{
				// bet room
				Method:  http.MethodPost,
				Path:    "/bet",
				Handler: room.BetHandler(serverCtx),
			},
			{
				// chat room
				Method:  http.MethodPost,
				Path:    "/chat",
				Handler: room.ChatHandler(serverCtx),
			},
			{
				// create room
				Method:  http.MethodPost,
				Path:    "/create",
				Handler: room.CreateRoomHandler(serverCtx),
			},
			{
				// join room
				Method:  http.MethodPost,
				Path:    "/join",
				Handler: room.JoinRoomHandler(serverCtx),
			},
			{
				// leave room
				Method:  http.MethodPost,
				Path:    "/leave",
				Handler: room.LeaveRoomHandler(serverCtx),
			},
			{
				// get room list
				Method:  http.MethodPost,
				Path:    "/list",
				Handler: room.RoomListHandler(serverCtx),
			},
			{
				// sitDown room
				Method:  http.MethodPost,
				Path:    "/sitdown",
				Handler: room.SitDownHandler(serverCtx),
			},
			{
				// standUp
				Method:  http.MethodPost,
				Path:    "/standup",
				Handler: room.StandUpHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
		rest.WithPrefix("/api/room"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.UserAgentMiddleware},
			[]rest.Route{
				{
					// login
					Method:  http.MethodPost,
					Path:    "/login",
					Handler: user.LoginHandler(serverCtx),
				},
				{
					// register
					Method:  http.MethodPost,
					Path:    "/register",
					Handler: user.RegisterHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/user"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				// get user info
				Method:  http.MethodPost,
				Path:    "/detail",
				Handler: user.DetailHandler(serverCtx),
			},
			{
				// get user info
				Method:  http.MethodPost,
				Path:    "/logout",
				Handler: user.LogoutHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
		rest.WithPrefix("/api/user"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				// ws
				Method:  http.MethodGet,
				Path:    "/ws",
				Handler: user.WsHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
		rest.WithPrefix("/api"),
	)
}
