package router

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

// 需认证的路由代码
func registerMallManageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {

	//mall := v1.Group("/mall").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
	mall := v1.Group("/mall").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
	{

		mall.POST("cat/create", mallmanage.GoodsCatCreate) // 分类添加
		mall.POST("cat/list", mallmanage.GoodsCatList)     // 分类列表
		mall.POST("cat/update", mallmanage.GoodsCatUpdate) // 分类修改
		mall.POST("cat/delete", mallmanage.GoodsCatDelete) // 分类删除

		mall.POST("spec/create", mallmanage.GoodsSpecCreate) // 规格添加
		mall.POST("spec/list", mallmanage.GoodsSpecList)     // 规格列表添加
		mall.POST("spec/update", mallmanage.GoodsSpecUpdate) // 规格修改

		mall.POST("spec_value/create", mallmanage.SpecValueCreate) // 规格值添加
		mall.POST("spec_value/list", mallmanage.SpecValueList)     // 规格值列表
		mall.POST("spec_value/update", mallmanage.SpecValueUpdate) // 规格值修改

	}

	//goods := mall.Group("/goods")
	goods := mall
	{
		goods.POST("goods/create", mallmanage.GoodsCreate)
		goods.POST("goods/list", mallmanage.GoodsList)
		goods.POST("goods/edit", mallmanage.GoodsEdit)
		goods.POST("goods/detail", mallmanage.GoodsDetail)
		goods.POST("goods/delete", mallmanage.GoodsDelete)

		goods.POST("goods/order/list", mallmanage.GoodsOrderList)                             // 列表
		goods.POST("goods/order/detail", mallmanage.GoodsOrderDetail)                         // 详情
		goods.POST("goods/order/deliver", mallmanage.GoodsOrderDeliver)                       // 发货
		goods.POST("goods/order/refund_send_receive", mallmanage.GoodsOrderRefundSendReceive) // 退货接收
		goods.POST("goods/user/vm_record", mallmanage.MallUserVmRecord)                       // 用户积分记录

		goods.POST("goods/attribute_add", mallmanage.GoodsAttributeAdd)       // 添加规格
		goods.POST("goods/attribute_m_del", mallmanage.GoodsAttributeMDel)    // 删除规格
		goods.POST("goods/attribute_update", mallmanage.GoodsAttributeUpdate) // 添加规格

		goods.POST("deliver_task/list", mallmanage.DeliverTaskList)     // 发货列表
		goods.POST("deliver_task/detail", mallmanage.DeliverTaskDetail) // 发货列表详情

	}

}

// 无需认证的路由代码
func registerMallManageUnAuthRouter(v1 *gin.RouterGroup) {
}
