package router

import (
	"github.com/gin-gonic/gin"
	"go-admin/app/admin/apis/purchasemanage"
	"go-admin/app/admin/middleware"
	jwt "go-admin/pkg/jwtauth"
)

func registerErpPurchaseManageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	r := v1.Group("/erp_purchase").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())

	r.POST("create", purchasemanage.ErpPurchaseCreate)       // 创建采购订单（入库/退货）
	r.POST("edit", purchasemanage.ErpPurchaseEdit)           // 编辑采购订单
	r.POST("list", purchasemanage.ErpPurchaseList)           // 查询采购订单列表
	r.POST("detail", purchasemanage.ErpPurchaseDetail)       // 查询采购订单详情
	r.POST("audit", purchasemanage.ErpPurchaseAudit)         // 审核采购订单
	r.POST("delete", purchasemanage.ErpPurchaseDelete)       // 删除采购订单
	r.POST("inventory", purchasemanage.ErpPurchaseInventory) // 入库（退货）
	r.POST("terminate", purchasemanage.ErpPurchaseTerminate) // 终止
	r.POST("execute", purchasemanage.ErpPurchaseExecute)     // 执行

	r.POST("demand/create", purchasemanage.ErpPurchaseDemandCreate) // 创建采购需求
	r.POST("demand/get", purchasemanage.ErpPurchaseDemandGet)       // 获取采购需求
	r.POST("demand/finish", purchasemanage.ErpPurchaseDemandFinish) // 完成采购需求

	r.POST("report/order", purchasemanage.ErpPurchaseReportByOrder)         // 采购报表（按单）
	r.POST("report/commodity", purchasemanage.ErpPurchaseReportByCommodity) // 采购报表（按商品）
	r.POST("report/supplier", purchasemanage.ErpPurchaseReportBySupplier)   // 供应商采购汇总
	r.POST("report/detail", purchasemanage.ErpPurchaseReportDetail)         // 采购明细

	r.POST("change/create", purchasemanage.ErpPurchaseChangeCreate) // 采购换机-新增
	r.POST("change/edit", purchasemanage.ErpPurchaseChangeEdit)     // 采购换机-编辑
	r.POST("change/list", purchasemanage.ErpPurchaseChangeList)     // 采购换机-列表
	r.POST("change/delete", purchasemanage.ErpPurchaseChangeDelete) // 采购换机-删除
	r.POST("change/audit", purchasemanage.ErpPurchaseChangeAudit)   // 采购换机-审核
}
