package router

import (
	"cold-delivery/common/actions"

	"github.com/gin-gonic/gin"

	"cold-delivery/app/admin/controller"
	jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth"
)

func init() {
	routerCheckRole = append(routerCheckRole, registerSysUserRouter)
	routerNoCheckRole = append(routerNoCheckRole, registerSysUserRouter2)

}

// 需认证的路由代码
func registerSysUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	cont := controller.SysUser{}
	r := v1.Group("/sys-user").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
	{
		r.GET("", cont.GetPage)
		r.GET("/:id", cont.Get)
		r.POST("", cont.Insert)
		r.PUT("", cont.Update)
		r.DELETE("", cont.Delete)
		r.PUT("/pwd/reset", cont.ResetPwd)
	}

	user := v1.Group("/user").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
	{
		user.GET("/profile", cont.GetProfile)
		user.GET("/info", cont.GetInfo)
		user.PUT("/status", cont.UpdateStatus)
		user.PUT("/pwd/set", cont.UpdatePwd)

	}

}
func registerSysUserRouter2(router *gin.RouterGroup) {
	r := router.Group("")
	{
		r.GET("/verify-code", controller.SysUser{}.VerifyCode)
	}
}
