package controller

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"service/api/base"
	"service/api/consts"
)

func Init(r *gin.Engine) {
	r.HandleMethodNotAllowed = true

	r.GET("/seeyouagain", SeeYouAgainHandler)
}

func ReplyOk(ctx *gin.Context, data any) {
	ctx.JSON(http.StatusOK, base.BaseResponse{
		Ret:     consts.RetCodeSuccess,
		ErrCode: consts.ErrorCodeSuccess,
		Data:    data,
	})
}

func ReplyErrorMsg(ctx *gin.Context, msg string) {
	ctx.AbortWithStatusJSON(http.StatusOK, base.BaseResponse{
		Ret:     consts.RetCodeFail,
		ErrCode: consts.ErrorCodeFail,
		Msg:     msg,
	})
}