package net.lab1024.sa.admin.module.business.wms.excel;

import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Tag(name = "导出")
@Slf4j
public class ExportTaskController {

    @Resource
    private ExportTaskService exportTaskService;

    @PostMapping("/export/createExportTask")
    public ResponseDTO<String> createExportTask() {
        String taskId = exportTaskService.createTask();
        return ResponseDTO.ok(taskId);
    }

    @GetMapping("/export/progress/{taskId}")
    public ResponseDTO<Long> getExportProgress(@PathVariable String taskId) {
        Long progress = exportTaskService.getProgress(taskId);
        return ResponseDTO.ok(progress);
    }
}
