package com.seer.teach.admin.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.teacher.common.req.ReportReq;
import com.seer.teach.teacher.common.resp.UserReportResp;
import com.seer.teach.teacher.service.ReportService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.constraints.NotNull;

@RequestMapping("/report")
@RestController
@Tag(name = "后台 - 用户做题报告")
@Validated
@RequiredArgsConstructor
public class ReportAdminController {

    private final ReportService reportService;


    @GetMapping("/{deviceId}")
    @Operation(summary = "用户做题报告")
    @LogPrint
    @SaCheckPermission("teacher:admin:report:getReport")
    public ResultBean<UserReportResp> report(@PathVariable("deviceId") @NotNull(message = "设备ID不可为空") Integer deviceId) {
        UserReportResp report = reportService.reportByDeviceId(deviceId, new ReportReq(2));
        return ResultBean.success(report);
    }
}
