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

func registerPackageSeriesRoutes(router fiber.Router, handler *admin.PackageSeriesHandler, doc *openapi.Generator, basePath string) {
	series := router.Group("/package-series")
	groupPath := basePath + "/package-series"

	Register(series, doc, groupPath, "GET", "", handler.List, RouteSpec{
		Summary: "套餐系列列表",
		Tags:    []string{"套餐系列管理"},
		Input:   new(dto.PackageSeriesListRequest),
		Output:  new(dto.PackageSeriesPageResult),
		Auth:    true,
	})

	Register(series, doc, groupPath, "POST", "", handler.Create, RouteSpec{
		Summary: "创建套餐系列",
		Tags:    []string{"套餐系列管理"},
		Input:   new(dto.CreatePackageSeriesRequest),
		Output:  new(dto.PackageSeriesResponse),
		Auth:    true,
	})

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

	Register(series, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
		Summary: "更新套餐系列",
		Tags:    []string{"套餐系列管理"},
		Input:   new(dto.UpdatePackageSeriesParams),
		Output:  new(dto.PackageSeriesResponse),
		Auth:    true,
	})

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

	Register(series, doc, groupPath, "PATCH", "/:id/status", handler.UpdateStatus, RouteSpec{
		Summary: "更新套餐系列状态",
		Tags:    []string{"套餐系列管理"},
		Input:   new(dto.UpdatePackageSeriesStatusParams),
		Output:  nil,
		Auth:    true,
	})
}
