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, registerWeianRouter)
	routerOpenapi = append(routerOpenapi, registerOpenApiRouter)
}

// 派费管理
// 需认证的路由代码
func registerWeianRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	cont := controller.WeianController{}
	r := v1.Group("/weian").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
	{
		r.GET("/orderInfo", cont.GetOrderInfo)
	}
}

func registerOpenApiRouter(v1 *gin.RouterGroup, openapiMiddleware gin.HandlerFunc) {
	cont := controller.WeianController{}
	r := v1.Group("/waybill").Use(openapiMiddleware)
	{
		r.GET("/waybillNoByOrderId", cont.GetWaybillNo)
		r.GET("/data", cont.GetWaybillData)
		r.GET("/locus", cont.GetLocus)
	}
}
