package top.continew.admin.controller.business;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import top.continew.admin.business.model.req.FreeQuotaGrantReq;
import top.continew.admin.business.model.resp.FreeQuotaGrantResp;
import top.continew.admin.business.service.FreeQuotaGrantService;

/**
 * 免费额度赠送 API
 *
 * @author jiay
 * @since 2025/11/17
 */
@Tag(name = "免费额度赠送 API")
@RequiredArgsConstructor
@RestController
@RequestMapping("/free-quota/grant")
public class FreeQuotaGrantController {

    private final FreeQuotaGrantService freeQuotaGrantService;

    @Operation(summary = "批量赠送免费额度", description = "支持批量赠送给用户或部门，可自定义额度或使用默认配置")
    @PostMapping("/batch")
    public FreeQuotaGrantResp batchGrant(@RequestBody @Valid FreeQuotaGrantReq req) {
        //return freeQuotaGrantService.batchGrant(req);

        return FreeQuotaGrantResp.builder().build();
    }

    @Operation(summary = "给单个用户赠送默认免费额度", description = "给指定用户赠送所有启用的默认免费额度")
    @PostMapping("/user/{userId}")
    public FreeQuotaGrantResp grantToUser(@Parameter(description = "用户ID", required = true) @PathVariable Long userId) {
        //return freeQuotaGrantService.grantToUser(userId);
        return FreeQuotaGrantResp.builder().build();
    }

    @Operation(summary = "给部门所有用户赠送默认免费额度", description = "给指定部门下所有用户赠送所有启用的默认免费额度")
    @PostMapping("/dept/{deptId}")
    public FreeQuotaGrantResp grantToDept(@Parameter(description = "部门ID", required = true) @PathVariable Long deptId) {
        //return freeQuotaGrantService.grantToDept(deptId);
        return FreeQuotaGrantResp.builder().build();
    }
}
