package routes

import (
	"github.com/gofiber/fiber/v2"

	"github.com/break/junhong_cmp_fiber/internal/handler/admin"
	"github.com/break/junhong_cmp_fiber/internal/model/dto"
	"github.com/break/junhong_cmp_fiber/pkg/openapi"
)

// registerShopSeriesAllocationRoutes 注册套餐系列分配相关路由
func registerShopSeriesAllocationRoutes(router fiber.Router, handler *admin.ShopSeriesAllocationHandler, doc *openapi.Generator, basePath string) {
	allocations := router.Group("/shop-series-allocations")
	groupPath := basePath + "/shop-series-allocations"

	Register(allocations, doc, groupPath, "GET", "", handler.List, RouteSpec{
		Summary: "套餐系列分配列表",
		Tags:    []string{"套餐系列分配"},
		Input:   new(dto.ShopSeriesAllocationListRequest),
		Output:  new(dto.ShopSeriesAllocationPageResult),
		Auth:    true,
	})

	Register(allocations, doc, groupPath, "POST", "", handler.Create, RouteSpec{
		Summary: "创建套餐系列分配",
		Tags:    []string{"套餐系列分配"},
		Input:   new(dto.CreateShopSeriesAllocationRequest),
		Output:  new(dto.ShopSeriesAllocationResponse),
		Auth:    true,
	})

	Register(allocations, doc, groupPath, "GET", "/:id", handler.Get, RouteSpec{
		Summary: "获取套餐系列分配详情",
		Tags:    []string{"套餐系列分配"},
		Input:   new(dto.IDReq),
		Output:  new(dto.ShopSeriesAllocationResponse),
		Auth:    true,
	})

	Register(allocations, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
		Summary: "更新套餐系列分配",
		Tags:    []string{"套餐系列分配"},
		Input:   new(dto.UpdateShopSeriesAllocationParams),
		Output:  new(dto.ShopSeriesAllocationResponse),
		Auth:    true,
	})

	Register(allocations, doc, groupPath, "DELETE", "/:id", handler.Delete, RouteSpec{
		Summary: "删除套餐系列分配",
		Tags:    []string{"套餐系列分配"},
		Input:   new(dto.IDReq),
		Output:  nil,
		Auth:    true,
	})

	Register(allocations, doc, groupPath, "PUT", "/:id/status", handler.UpdateStatus, RouteSpec{
		Summary: "更新套餐系列分配状态",
		Tags:    []string{"套餐系列分配"},
		Input:   new(dto.UpdateStatusParams),
		Output:  nil,
		Auth:    true,
	})
}
