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

// registerPollingMonitoringRoutes 注册轮询监控路由
func registerPollingMonitoringRoutes(router fiber.Router, handler *admin.PollingMonitoringHandler, doc *openapi.Generator, basePath string) {
	stats := router.Group("/polling-stats")
	groupPath := basePath + "/polling-stats"

	Register(stats, doc, groupPath, "GET", "", handler.GetOverview, RouteSpec{
		Summary: "获取轮询总览统计",
		Tags:    []string{"轮询管理-监控"},
		Input:   nil,
		Output:  new(dto.PollingOverviewResp),
		Auth:    true,
	})

	Register(stats, doc, groupPath, "GET", "/queues", handler.GetQueueStatuses, RouteSpec{
		Summary: "获取轮询队列状态",
		Tags:    []string{"轮询管理-监控"},
		Input:   nil,
		Output:  new(dto.PollingQueueStatusListResp),
		Auth:    true,
	})

	Register(stats, doc, groupPath, "GET", "/tasks", handler.GetTaskStatuses, RouteSpec{
		Summary: "获取轮询任务统计",
		Tags:    []string{"轮询管理-监控"},
		Input:   nil,
		Output:  new(dto.PollingTaskStatsListResp),
		Auth:    true,
	})

	Register(stats, doc, groupPath, "GET", "/init-progress", handler.GetInitProgress, RouteSpec{
		Summary: "获取轮询初始化进度",
		Tags:    []string{"轮询管理-监控"},
		Input:   nil,
		Output:  new(dto.PollingInitProgressResp),
		Auth:    true,
	})
}
