package cn.cslg.report.controller;
import cn.cslg.report.common.core.base.Constants;
import cn.cslg.report.common.model.vo.CompareFilesVO;
import cn.cslg.report.common.model.vo.PatentVO;
import cn.cslg.report.service.business.CompareFilesService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.List;


@Tag(name = "对比专利管理")
@RestController
@RequestMapping(Constants.REPORT_API + "/compare")
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class CompareController {
    private final CompareFilesService compareFilesService;

    @RequestMapping(value = "/addCompareFile", method = RequestMethod.POST)
    @Operation(summary = "添加对比文件")
    public String addCompareFile(@RequestBody CompareFilesVO compareFilesVO) throws IOException {
        String res =   compareFilesService.addCompareFile(compareFilesVO);
        return res;
    }

    @RequestMapping(value = "/getCompareFile", method = RequestMethod.POST)
    @Operation(summary = "获得对比文件详情(分页）")
    public String getCompareFile(@RequestBody PatentVO patentVO) throws IOException {
        String res = compareFilesService.getCompareFile(patentVO);
        return res;
    }

    @RequestMapping(value = "/getSureCompareFile", method = RequestMethod.POST)
    @Operation(summary = "获得已确定的对比文件详情(分页）")
    public String getSureCompareFile(@RequestBody PatentVO patentVO) throws IOException {
        String res = compareFilesService.getSureCompareFile(patentVO);
        return res;
    }

    @RequestMapping(value = "/getCompareNos", method = RequestMethod.GET)
    @Operation(summary = "获得对比专利号")
    public String getCompareNos(Integer reportId) throws IOException {
        String res = compareFilesService.getCompareNos(reportId);
        return res;
    }

    @RequestMapping(value = "/deleteCompareNo", method = RequestMethod.POST)
    @Operation(summary = "删除多个对比专利")
    public String deleteCompareNo(@RequestBody  CompareFilesVO compareFilesVO) throws IOException {
        String res = compareFilesService.deletePatentNo(compareFilesVO);
        return res;
    }
}