import request from "@/utils/request";

//获取所有原始数据集列表
const list = (data) => {
    return request({
        url: `/dataset/raw`,
        method: "get",
        params: data
    });
}
//创建新数据集
const add = (data) => {
    return request({
        url: `/dataset/raw`,
        method: "post",
        data: data
    });
}
//删除指定的数据集
const deleteRaw = (id) => {
    return request({
        url: `/dataset/raw/${id}`,
        method: "delete"
    });
}
//获取指定的原始数据集
const dataSetInfo = (id) => {
    return request({
        url: `/dataset/raw/${id}`,
        method: "get"
    });
}
//更新指定数据集的内容
const updateDataSet = (id, data) => {
    return request({
        url: `/dataset/raw/${id}`,
        method: "put",
        data: data
    });
}
//下载图像文件
const downloadFile = (id) => {
    return request({
        url: `/dataset/raw/${id}/download`,
        method: 'get',
        params: data
    })
}
//删除指定的图像文件
const deleteFile = (id, data) => {
    return request({
        url: `/dataset/raw/${id}/files`,
        method: "delete",
        data: data
    });
}
//获取指定的数据集列表
const rawFiles = (id) => {
    return request({
        url: `/dataset/raw/${id}/files`,
        method: "get"
    });
}
//上传数据文件
const rawUpload = (id, data) => {
    return request({
        url: `/dataset/raw/${id}/upload`,
        method: "post",
        data: data,
        headers: {
            "Content-Type": "multipart/form-data",
        },
    });
}

export default {
    list,
    add,
    deleteRaw,
    dataSetInfo,
    updateDataSet,
    downloadFile,
    deleteFile,
    rawFiles,
    rawUpload,
}
