package com.yingpaipay.business.controller;


import cn.dev33.satoken.annotation.SaCheckPermission;
import com.yingpaipay.business.domain.bo.DocumentQcAuditBo;
import com.yingpaipay.business.domain.bo.DocumentQcTaskDetailListBo;
import com.yingpaipay.business.domain.vo.DocumentQcGenerateVo;
import com.yingpaipay.business.domain.vo.DocumentQcTaskDetailListVo;
import com.yingpaipay.business.domain.vo.DocumentQcTaskDetailVo;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.web.core.BaseController;
import com.yingpaipay.business.service.IDocumentQcTaskDetailService;

import java.util.List;

/**
 * 文档质控细节
 *
 * @author Huanyi
 * @date 2026-01-08
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/qcTask/detail")
public class DocumentQcTaskDetailController extends BaseController {

    private final IDocumentQcTaskDetailService documentQcTaskDetailService;

    @Deprecated
    @GetMapping("/generate")
    public R<List<DocumentQcGenerateVo>> generate(@RequestParam Long projectId) {
        return R.ok(documentQcTaskDetailService.generate(projectId));
    }

    @GetMapping("/listPage")
    public TableDataInfo<DocumentQcTaskDetailListVo> listPage(DocumentQcTaskDetailListBo bo, PageQuery pageQuery) {
        return documentQcTaskDetailService.listPage(bo, pageQuery);
    }

    @SaCheckPermission("qc:task:audit")
    @Log(title = "文档指控细节", businessType = BusinessType.UPDATE)
    @PutMapping("/audit")
    public R<Void> audit(@RequestBody DocumentQcAuditBo bo) {
        return toAjax(documentQcTaskDetailService.audit(bo));
    }

}
