import request from '../utils/request'

/**
 * 上传文件
 */
export function uploadFile(formData) {
  return request({
    timeout: 1200000,
    url: '/api/oss-file/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/**
 * 获取文件列表
 */
export function getFileList(params) {
  return request({
    url: '/api/oss-file/list',
    method: 'get',
    params
  })
}

/**
 * 获取文件详情
 */
export function getFileDetail(id) {
  return request({
    url: `/api/oss-file/${id}`,
    method: 'get'
  })
}

/**
 * 删除文件
 */
export function deleteFile(id) {
  return request({
    url: `/api/oss-file/${id}`,
    method: 'delete'
  })
}

/**
 * 批量删除文件
 */
export function batchDeleteFiles(fileIds) {
  return request({
    url: '/api/oss-file/batch',
    method: 'delete',
    params: {
      fileIds
    }
  })
}
