import request from '@/utils/request'

// 查询文件基础列表
export function listFile(query) {
  return request({
    url: '/ai/dataSetBasicFile/list',
    method: 'get',
    params: query
  })
}
export function delList(query) {
  return request({
    url: '/ai/dataSetBasicFile/delList',
    method: 'get',
    params: query
  })
}
export function isPublicList(query) {
  return request({
    url: '/ai/dataSetBasicFile/isPublicList',
    method: 'get',
    params: query
  })
}

// 查询文件基础详细
export function getFile(fileId) {
  return request({
    url: '/ai/dataSetBasicFile/getFile/' + fileId,
    method: 'get'
  })
}

// 新增文件基础
export function addFile(data) {
  return request({
    url: '/ai/dataSetBasicFile/add',
    method: 'post',
    data: data
  })
}

// 修改文件基础
export function updateFile(data) {
  return request({
    url: '/ai/dataSetBasicFile/update',
    method: 'post',
    data: data
  })
}

export function moveFile(data) {
  return request({
    url: '/ai/dataSetBasicFile/moveFile',
    method: 'post',
    data: data
  })
}


// 删除文件基础
export function delFile(fileId) {
  return request({
    url: '/ai/dataSetBasicFile/delete/' + fileId,
    method: 'post',
  })
}

export function dataRecovery(fileId) {
  return request({
    url: '/ai/dataSetBasicFile/dataRecovery/' + fileId,
    method: 'post',
  })
}
export function emptyRecycleBin() {
  return request({
    url: '/ai/dataSetBasicFile/emptyRecycleBin',
    method: 'post',
  })
}




export function sharedFilesByIds(fileId) {
  return request({
    url: '/ai/dataSetBasicFile/sharedFilesByIds/' + fileId,
    method: 'post',
  })
}

// 用户状态修改
export function changeIsPublic(fileId, isPublic) {
  const data = {
    fileId,
    isPublic
  }
  return request({
    url: '/ai/dataSetBasicFile/changeIsPublic',
    method: 'post',
    data: data
  })
}
// 上传文件
export function uploadFiles(formData) {
  return request({
    url: '/ai/dataSetBasicFile/uploadFiles',
    method: 'post',
    data: formData,
    timeout: 600000, // 设置超时时间为 10 秒（10000 毫秒）
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

export function getFileTerr(fileId) {
  return request({
    url: '/ai/dataSetBasicFile/getFileTerr/' + fileId,
    method: 'post'
  })
}



