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

// registerSystemConfigRoutes 注册受控系统配置路由。
func registerSystemConfigRoutes(router fiber.Router, handler *admin.SystemConfigHandler, doc *openapi.Generator, basePath string) {
	configs := router.Group("/system-configs")
	groupPath := basePath + "/system-configs"

	Register(configs, doc, groupPath, "GET", "", handler.List, RouteSpec{
		Summary: "查询受控系统配置",
		Tags:    []string{"系统配置"},
		Input:   new(dto.SystemConfigListRequest),
		Output:  new(dto.SystemConfigListResponse),
		Auth:    true,
	})

	Register(configs, doc, groupPath, "PUT", "/:key", handler.Update, RouteSpec{
		Summary: "更新受控系统配置",
		Tags:    []string{"系统配置"},
		Input:   new(dto.UpdateSystemConfigParams),
		Output:  new(dto.SystemConfigItem),
		Auth:    true,
	})
}
