package org.dromara.ai.controller.app;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.ai.domain.vo.AiUserQuotaVo;
import org.dromara.ai.service.AiUserQuotaService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户端AI用户配额
 *
 * @author pengles
 */
@Tag(name = "用户端-AI用户配额", description = "用户端AI用户配额接口")
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/ai/user/quota")
public class AppAiUserQuotaController {

    private final AiUserQuotaService aiUserQuotaService;

    /**
     * 查询当前用户的配额信息
     */
    @Operation(summary = "查询当前用户的配额信息", description = "查询当前登录用户的配额信息")
    @GetMapping
    public R<AiUserQuotaVo> getMyQuota() {
        Long userId = LoginHelper.getUserId();
        AiUserQuotaVo vo = aiUserQuotaService.queryByUserId(userId);
        return R.ok(vo);
    }

}
