package controller

import (
	"net/http"

	"metazone.cc/metalab/internal/common"

	"github.com/gin-gonic/gin"
)

// AuditStatus 查询当前用户的待审核类型（需登录）
func (sc *SettingsController) AuditStatus(c *gin.Context) {
	uid, exists := c.Get("uid")
	if !exists {
		common.Error(c, http.StatusUnauthorized, "请先登录")
		return
	}

	types, err := sc.auditService.GetPendingTypes(uid.(uint))
	if err != nil {
		common.Ok(c, gin.H{"pending_types": []string{}})
		return
	}
	if types == nil {
		types = []string{}
	}
	common.Ok(c, gin.H{"pending_types": types})
}
