package handler

import (
	"net/http"

	"github.com/gin-gonic/gin"

	"github.com/user-management-system/internal/service"
)

// SettingsHandler 系统设置处理器
type SettingsHandler struct {
	settingsService *service.SettingsService
}

// NewSettingsHandler 创建系统设置处理器
func NewSettingsHandler(settingsService *service.SettingsService) *SettingsHandler {
	return &SettingsHandler{settingsService: settingsService}
}

// GetSettings 获取系统设置
// @Summary 获取系统设置
// @Description 获取系统配置、安全设置和功能开关信息
// @Tags 系统设置
// @Produce json
// @Security BearerAuth
// @Success 200 {object} Response{data=service.SystemSettings}
// @Router /api/v1/admin/settings [get]
func (h *SettingsHandler) GetSettings(c *gin.Context) {
	settings, err := h.settingsService.GetSettings(c.Request.Context())
	if err != nil {
		handleError(c, err)
		return
	}

	c.JSON(http.StatusOK, gin.H{"data": settings})
}
