package router

import (
	"cold-delivery/app/admin/controller"
	"cold-delivery/common/actions"
	"github.com/gin-gonic/gin"
	jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth"
)

func init() {
	routerCheckRole = append(routerCheckRole, registerCoolerBoxRouter)
}

// 需认证的路由代码
func registerCoolerBoxRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	cont := controller.CoolerBoxController{}
	r := v1.Group("/cooler-box").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
	{
		r.GET("", cont.GetPage)
		r.GET("/:id", cont.Get)
		r.POST("", cont.Insert)
		r.POST("/import", cont.BatchInsert)
		r.PUT("", cont.Update)
		r.DELETE("", cont.Delete)
		r.POST("/locus", cont.GetCollerBoxLocus)
		r.POST("/historylocus", cont.GetCoolerBoxLocus)
		r.GET("/getcoolerboxice", cont.GetCoolerBoxIce)
		r.GET("/getcoolerboxall", cont.GetCoolerBoxAll)
		r.POST("/coolerboxstarttime", cont.CoolerBoxStarTime)
		r.GET("/export-execl", cont.ExportExecl)
		r.PUT("/coolerBoxEndUse", cont.CoolerBoxEndUse)
	}
}
