import request from '/@/utils/request';

/**
 * 文件列表（分页）
 * @param query
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/filemanager/page',
    method: 'get',
    params: query
  });
};

/**
 * 文件列表（不分页，按层级）
 * @param query
 */
export const getList = (query?: any) => {
  return request({
    url: '/stuwork/filemanager/list',
    method: 'get',
    params: query
  });
};

/**
 * 文件详情
 * @param id
 */
export const getDetail = (id: string) => {
  return request({
    url: '/stuwork/filemanager/detail',
    method: 'get',
    params: { id }
  });
};

/**
 * 新增文件
 * @param data
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/filemanager',
    method: 'post',
    data
  });
};

/**
 * 编辑文件
 * @param data
 */
export const editObj = (data: any) => {
  return request({
    url: '/stuwork/filemanager/edit',
    method: 'post',
    data
  });
};

/**
 * 编辑文件夹
 * @param data
 */
export const editFile = (data: any) => {
  return request({
    url: '/stuwork/filemanager/editFile',
    method: 'post',
    data
  });
};

/**
 * 删除文件
 * @param ids
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/filemanager/delete',
    method: 'post',
    data: ids
  });
};
