package com.ruoyi.platform.service;

import com.ruoyi.platform.domain.Dataset;
import com.ruoyi.platform.domain.DatasetVersion;
import com.ruoyi.platform.vo.DatasetVo;
import com.ruoyi.platform.vo.NewDatasetVo;
import org.springframework.core.io.InputStreamResource;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

/**
 * (Dataset)表服务接口
 *
 * @author Xidaray
 * @since 2023-11-28 11:51:22
 */
public interface DatasetService {


    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    Dataset queryById(Integer id);

    /**
     * 分页查询
     *
     * @param dataset     筛选条件
     * @param pageRequest 分页对象
     * @return 查询结果
     */
    Page<Dataset> queryByPage(Dataset dataset, PageRequest pageRequest);

    /**
     * 新增数据
     *
     * @param dataset 实例对象
     * @return 实例对象
     */
    Dataset insert(Dataset dataset) throws Exception;


    /**
     * 修改数据
     *
     * @param dataset 实例对象
     * @return 实例对象
     */
    Dataset update(Dataset dataset);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    boolean deleteById(Integer id);

    String removeById(Integer id) throws Exception;

    ResponseEntity<InputStreamResource> downloadDataset(Integer id) throws Exception;

    List<Map<String, String>> uploadDataset(MultipartFile[] files, String uuid) throws Exception;

    Map uploadDatasetPipeline(DatasetVersion datasetVersion) throws Exception;

    List<String> getDatasetVersions(Integer datasetId) throws Exception;

    String insertDatasetAndVersion(DatasetVo datasetVo) throws Exception;

    void checkDeclaredName(Dataset insert) throws Exception;

    ResponseEntity<InputStreamResource> downloadAllDatasetFiles(Integer datasetId, String version) throws Exception;

    List<Map<String, String>> exportDataset(String path, String uuid) throws Exception;

}