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.MaterialDocDataParseLogsPageReq;
import com.seer.teach.admin.service.AdminMaterialDocDataParseLogService;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
import com.seer.teach.teacher.module.entity.MaterialDocDataParseLog;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;

/**
 * 教材文档数据解析日志控制器
 * 提供对教材文档解析日志的查询接口
 */
@Slf4j
@RestController
@RequestMapping("/teacher/material-doc-parse-log")
@Tag(name = "管理端 - 教材文档解析日志")
@Validated
@RequiredArgsConstructor
public class AdminMaterialDocDataParseLogController {

    private final AdminMaterialDocDataParseLogService adminMaterialDocDataParseLogService;

    /**
     * 分页查询教材文档解析日志
     *
     * @return 教材文档解析日志分页列表
     */
    @PostMapping("/paged")
    @Operation(summary = "分页查询教材文档解析日志")
    @SaCheckPermission("teacher:admin:material-doc-parse-log:list")
    public ResultBean<PageListBean<MaterialDocDataParseLog>> pageMaterialDocDataParseLogs(@RequestBody MaterialDocDataParseLogsPageReq req) {
        IPage<MaterialDocDataParseLog> result = adminMaterialDocDataParseLogService.pageMaterialDocDataParseLogs(req);
        return ResultBean.success(new PageListBean<>(result));
    }
}