import request from '@/utils/request'

export function folderList(query) {
  return request({ url: '/efinder/folder/list', method: 'get', params: query })
}

export function getFileList(query) {
  return request({ url: '/efinder/file/list', method: 'get', params: query })
}

export function getFileInfo(fileId) {
  return request({ url: '/efinder/file/' + fileId, method: 'get' })
}

export function uploadFile(data) {
  return request({ url: '/efinder/file/upload', method: 'post', data: data, headers: { 'Content-Type': 'multipart/form-data' } })
}

export function downloadFile(fileId) {
  return request({ url: '/efinder/file/download/' + fileId, method: 'get', responseType: 'blob' })
}

export function renameFile(data) {
  return request({ url: '/efinder/file/rename', method: 'put', data: data })
}

export function moveFile(data) {
  return request({ url: '/efinder/file/move', method: 'put', data: data })
}

export function mkdir(data) {
  return request({ url: '/efinder/folder', method: 'post', data: data })
}

export function deleteFile(id) {
  return request({ url: '/efinder/file/' + id, method: 'delete' })
}

export function deleteFolder(id) {
  return request({ url: '/efinder/folder/' + id, method: 'delete' })
}
