package com.datamate.datamanagement.interfaces.rest;

import com.datamate.datamanagement.application.DatasetFileApplicationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 数据集上传控制器
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/data-management/datasets/upload")
public class DatasetUploadController {

    private final DatasetFileApplicationService datasetFileApplicationService;

    /**
     * 取消上传
     *
     * @param reqId 预上传请求ID
     */
    @PutMapping("/cancel-upload/{reqId}")
    public ResponseEntity<Void> cancelUpload(@PathVariable("reqId") String reqId) {
        datasetFileApplicationService.cancelUpload(reqId);
        return ResponseEntity.ok().build();
    }
}
