package cn.cslg.report.controller;

import cn.cslg.report.common.core.base.Constants;
import cn.cslg.report.entity.ReportDocument;
import cn.cslg.report.entity.Template;
import cn.cslg.report.service.business.ReportDocumentService;
import cn.cslg.report.service.business.TemplateService;
import io.swagger.v3.oas.annotations.Operation;
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;

@Tag(name = "文件导出")
@RestController
@RequestMapping(Constants.REPORT_API + "/reportDocument")
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class ReportDocumentController {
    public final ReportDocumentService reportDocumentService;
    @RequestMapping(value = "/exportReport", method = RequestMethod.GET)
    @Operation(summary = "导出报告")
    public  String exportReport(Integer reportId,Integer templeId) throws IOException {
        return reportDocumentService.exportReport(reportId,templeId);
    }

    @RequestMapping(value = "/getExportList", method = RequestMethod.POST)
    @Operation(summary = "获得导出记录")
    public  String getExportList(@RequestBody ReportDocument reportDocument) throws IOException {
        return reportDocumentService.getExportList(reportDocument);
    }

    @RequestMapping(value = "/deleteExport", method = RequestMethod.GET)
    @Operation(summary = "删除导出记录")
    public  String deleteExport(Integer id) throws IOException {
        return reportDocumentService.deleteExport(id);
    }
    
}
