package com.seer.teach.admin.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.seer.teach.admin.request.QuestionGenerationLogQueryReq;
import com.seer.teach.admin.response.QuestionGenerationLogResp;
import com.seer.teach.admin.service.AdminQuestionGenerationLogService;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 管理端 - 题目生成日志管理
 * </p>
 *
 * @author Lingma
 * @since 2025-11-21
 */
@RestController
@RequestMapping("/teacher/question-generation-logs")
@RequiredArgsConstructor
@Tag(name = "管理端 - 题目生成日志管理")
@Validated
public class AdminQuestionGenerationLogController {

    private final AdminQuestionGenerationLogService adminQuestionGenerationLogService;

    @PostMapping("/page-list")
    @Operation(summary = "分页查询题目生成日志列表")
    @SaCheckPermission("teacher:admin:question-generation-logs:list")
    public ResultBean<PageListBean<QuestionGenerationLogResp>> pageQuestionGenerationLogs(@RequestBody @Validated QuestionGenerationLogQueryReq req) {
        IPage<QuestionGenerationLogResp> page = adminQuestionGenerationLogService.pageQuestionGenerationLogs(req);
        return ResultBean.success(new PageListBean<>(page));
    }
}