import request from '@/utils/request';

/**
 * 备份数据库 - 下载SQL文件
 */
export function backupDatabase() {
  return request({
    url: '/system/backup/backup',
    method: 'get',
    responseType: 'blob'
  });
}

/**
 * 恢复数据库 - 上传SQL文件
 * @param file SQL文件
 */
export function restoreDatabase(file: File) {
  const formData = new FormData();
  formData.append('file', file);

  return request({
    url: '/system/backup/restore',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}
