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"
)

// registerOrderPackageInvalidateRoutes 注册订单套餐批量失效任务路由
func registerOrderPackageInvalidateRoutes(router fiber.Router, handler *admin.OrderPackageInvalidateHandler, doc *openapi.Generator, basePath string) {
	group := router.Group("/order-package-invalidate-tasks")
	groupPath := basePath + "/order-package-invalidate-tasks"

	Register(group, doc, groupPath, "POST", "", handler.Create, RouteSpec{
		Summary:     "创建订单套餐批量失效任务",
		Description: "上传单列 CSV 文件（列名 order_no），批量将订单下的非终态套餐标记为已失效（status=4）。",
		Tags:        []string{"订单套餐失效"},
		Input:       new(dto.CreateOrderPackageInvalidateTaskRequest),
		Output:      new(dto.OrderPackageInvalidateTaskResponse),
		Auth:        true,
	})

	Register(group, doc, groupPath, "GET", "", handler.List, RouteSpec{
		Summary: "查询订单套餐失效任务列表",
		Tags:    []string{"订单套餐失效"},
		Input:   new(dto.ListOrderPackageInvalidateTaskRequest),
		Output:  new(dto.OrderPackageInvalidateTaskListResponse),
		Auth:    true,
	})

	Register(group, doc, groupPath, "GET", "/:id", handler.GetByID, RouteSpec{
		Summary: "查询订单套餐失效任务详情",
		Tags:    []string{"订单套餐失效"},
		Input:   new(dto.IDReq),
		Output:  new(dto.OrderPackageInvalidateTaskDetailResponse),
		Auth:    true,
	})
}
