import { defHttp } from '/@/utils/http/axios';
import { setParams } from '/@/utils/index';
enum Api {
  storageAdd = '/storage/add',
  storageDetail = '/storage/detail',
  storageDownloadStorageId = '/storage/download',
  storageEdit = '/storage/edit',
  storageExport = '/storage/export',
  storageQueryList = '/storage/query/list',
  storageRemove = '/storage/remove',
  storageReviewStorageId = '/storage/review',
  storageUpload = '/storage/upload',
}

/**
 * @description: 新增文件存储,权限 - sys:storage:add
 * @method: POST
 */
export const storageAdd = (params?: object) => {
  return defHttp.post({ url: Api.storageAdd, params: params });
};
/**
 * @description: 获取文件存储详细信息,权限 - sys:storage:query
 * @method: POST
 */
export const storageDetail = (params?: object) => {
  return defHttp.post({ url: Api.storageDetail, params: params });
};
/**
 * @description: 文件下载
 * @method: GET
 */
export const storageDownloadStorageId = (storageId?: string | number, params?: object) => {
  return defHttp.get({ url: Api.storageDownloadStorageId + '/' + storageId, params: params });
};
/**
 * @description: 通过主键id修改文件存储,权限 - sys:storage:edit
 * @method: POST
 */
export const storageEdit = (params?: object) => {
  return defHttp.post({ url: Api.storageEdit, params: params });
};
/**
 * @description: 导出文件存储
 * @method: POST
 */
export const storageExport = (params?: object) => {
  return defHttp.post({ url: Api.storageExport, params: params });
};
/**
 * @description: 查询文件存储列表,权限 - sys:storage:list
 * @method: POST
 */
export const storageQueryList = (params?: object) => {
  return defHttp.post({ url: Api.storageQueryList, params: setParams(params) });
};
/**
 * @description: 删除文件存储,权限 - sys:storage:remove
 * @method: POST
 */
export const storageRemove = (params?: object) => {
  return defHttp.post({ url: Api.storageRemove, params: params });
};
/**
 * @description: 文件预览
 * @method: GET
 */
export const storageReviewStorageId = (storageId?: string | number, params?: object) => {
  return defHttp.get({ url: Api.storageReviewStorageId + '/' + storageId, params: params });
};
/**
 * @description: 文件上传
 * @method: POST
 */
export const storageUpload = (params?: object) => {
  return defHttp.post({ url: Api.storageUpload, params: params });
};
