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, registerDeviceRouter)
}

// 需认证的路由代码
func registerDeviceRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	cont := controller.DeviceController{}
	r := v1.Group("/device").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
	{
		r.GET("", cont.GetDevicePage)
	}
	r2 := v1.Group("/device-sensor").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
	{
		r2.GET("", cont.GetDeviceSensorPage)
		r2.GET("/data", cont.GetDeviceSensorDataPage)
	}
}
