package router

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

// 需认证的路由代码
func registerGoodsManageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	goods := v1.Group("/goods").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
	{
		goods.POST("/goods_list", goodsmanage.GameCardGoodsList) // 获取游戏卡列表
	}
}

// 无需认证的路由代码
func registerGoodsManageUnAuthRouter(v1 *gin.RouterGroup) {
	goods := v1.Group("/goods")
	{
		goods.POST("/list", goodsmanage.GameCardList)                              // 获取游戏列表
		goods.POST("/add", goodsmanage.GameCardAdd)                                // 添加游戏
		goods.POST("/modify", goodsmanage.GameCardModify)                          // 修改游戏
		goods.POST("/type", goodsmanage.GameCardTypes)                             // 获取游戏类型
		goods.POST("/modify/type", goodsmanage.GameCardModifyType)                 // 修改游戏类型
		goods.POST("/del", goodsmanage.GameCardMDel)                               // 删除游戏
		goods.POST("/stand_up_down", goodsmanage.BatchStandUpDown)                 // 游戏上下架
		goods.POST("/stand_up", goodsmanage.BatchStandUp)                          // 游戏
		goods.POST("/card_pool/analysis", goodsmanage.OrderAndStockAnalysis)       // 游戏
		goods.POST("/card_pool/stock_analysis", goodsmanage.GameCardStockAnalysis) // 游戏库存
		goods.POST("/label_add", goodsmanage.GameCardLabelAdd)                     // 游戏添加标签
		goods.POST("/label_list", goodsmanage.GameCardLabelList)                   // 游戏添加标签

		goods.POST("type/add", goodsmanage.GameTypeAdd)               // 游戏添加类型
		goods.POST("aliyun/sts_token", goodsmanage.AliyunStsTokenGet) // oss

	}

	gs := goods.Group("/search")
	{
		gs.GET("/hot/list", goodsmanage.GetHotSearch)       // 热门搜索列表
		gs.POST("/hot/del", goodsmanage.HotSearchDel)       // 热门搜索删除
		gs.POST("/hot/add", goodsmanage.HotSearchAdd)       // 热门搜索添加
		gs.POST("/hot/modify", goodsmanage.HotSearchModify) // 热门搜索修改
	}

	gt := goods.Group("/game_type")
	{
		gt.POST("/list", goodsmanage.GameCardTypeList)     // 游戏类型列表
		gt.POST("/modify", goodsmanage.GameCardTypeModify) // 游戏类型修改
		gt.POST("/add", goodsmanage.GameCardTypeAdd)       // 游戏类型添加
		gt.POST("/del", goodsmanage.GameCardTypeDel)       // 游戏类型删除
	}

	slideshow := v1.Group("/slideshow")
	{
		slideshow.POST("/list", goodsmanage.HomeCarouselList)     // 轮播图列表
		slideshow.POST("/add", goodsmanage.HomeCarouselAdd)       // 轮播图添加
		slideshow.POST("/del", goodsmanage.HomeCarouselDel)       // 轮播图删除
		slideshow.POST("/modify", goodsmanage.HomeCarouselModify) // 轮播图修改
	}

	homeCategory := v1.Group("/home_category") // 首页分类
	{
		homeCategory.POST("/list", goodsmanage.HomeCategoryList)     // 列表
		homeCategory.POST("/add", goodsmanage.HomeCategoryAdd)       // 新增
		homeCategory.POST("/edit", goodsmanage.HomeCategoryEdit)     // 编辑
		homeCategory.POST("/delete", goodsmanage.HomeCategoryDelete) // 删除
	}
}
