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

// 需认证的路由代码
func registerCompanyRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	cont := controller.CompanyController{}

	r := v1.Group("/company").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
	{
		r.GET("", cont.GetPage)
		r.GET("/dept", cont.GetCurrentCompany)
		r.GET("/user", cont.GetUserPage)
		r.GET("/all", cont.GetAll)
		r.GET("/third-tree", cont.GetCompanyThirdTree)
		r.GET("/:id", cont.Get)
		r.POST("", cont.Insert)
		r.PUT("", cont.Update)
		r.DELETE("", cont.Delete)
		r.POST("/import-third-tree", cont.ImportThirdCompanyTree)
	}

}
