// 文件模块相关接口
import { moduleRequest } from '@/utils/reSourceRequest'

const request = moduleRequest(`/api/webapp/`)

/**
 * 获取文件列表相关接口
 */
// 获取文件列表（区分文件路径）
export const getFileListByPath = (p) => request('file/getfilelist', p, 'get')
// 获取文件列表（区分文件类型）
export const getFileListByType = (p) => request('file/selectfilebyfiletype', p, 'get')
// 获取回收站文件列表
export const getRecoveryFile = (p) => request('recoveryfile/list', p, 'get')
// 获取我已分享的文件列表
export const getMyShareFileList = (p) => request('share/shareList', p, 'get')
// 获取存储占用
export const getStorage = (p) => request('filetransfer/getstorage', p, 'get')
// 获取文件目录树
export const getFoldTree = (p) => request('file/getfiletree', p, 'get')
// 获取摆渡功能状态
export const getFerryStatus = () => request('file/getFerryStatus', {}, 'get')
/**
 * 单文件操作相关接口
 */
// 创建文件
export const createFold = (p) => request('file/createFold', p, 'post')
// 获取文件详细信息
export const getFileDetail = (p) => request('file/detail', p, 'get')
// 删除文件
export const deleteFile = (p) => request('file/deletefile', p, 'post')
// 复制文件
export const copyFile = (p) => request('file/copyfile', p, 'post')
// 移动文件
export const moveFile = (p) => request('file/movefile', p, 'post')
// 重命名文件
export const renameFile = (p) => request('file/renamefile', p, 'post')
// 解压文件
export const unzipFile = (p) => request('file/unzipfile', p, 'post')
// 全局搜索文件
export const searchFile = (p) => request('file/search', p, 'get')
// 全局搜索文件2
export const searchByFileName = (p) => request('file/searchByFileName', p, 'get')
// 分享文件
export const shareFile = (p) => request('share/sharefile', p, 'post')
// 校验分享链接过期时间
export const checkShareLinkEndtime = (p) => request('share/checkendtime', p, 'get')
// 校验分享链接是否需要提取码
export const checkShareLinkType = (p) => request('share/sharetype', p, 'get')
// 校验分享链接提取码是否正确
export const checkShareLinkCode = (p) => request('share/checkextractioncode', p, 'get')
// 获取分享文件列表
export const getShareFileList = (p) => request('share/sharefileList', p, 'get')
// 保存分享文件
export const saveShareFile = (p) => request('share/savesharefile', p, 'post')

/**
 * 文件批量操作相关接口
 */
// 批量删除文件
export const batchDeleteFile = (p) => request('file/batchdeletefile', p, 'post')
// 批量移动文件
export const batchMoveFile = (p) => request('file/batchmovefile', p, 'post')

/**
 * 回收站文件操作相关接口
 */
// 回收站文件删除
export const deleteRecoveryFile = (p) => request('recoveryfile/deleterecoveryfile', p, 'post')
// 回收站文件还原
export const restoreRecoveryFile = (p) => request('recoveryfile/restorefile', p, 'post')
// 回收站文件批量删除
export const batchDeleteRecoveryFile = (p) => request('recoveryfile/batchdelete', p, 'post')

/**
 * 文件公共接口
 */
// 文件预览
export const getFilePreview = (p) => request('filetransfer/preview', p, 'get', { skipCodeCheck: true })
// 文件修改
export const modifyFileContent = (p) => request('file/update', p, 'post')

/**
 * 查询敏感词列表
 */
export const getSensitiveList = (p) => request('sensitive/list', p, 'get')
export const addSensitiveList = (p) => request('sensitive/add', p, 'post')
export const delSensitiveList = (p) => request(`sensitive/delete/${p}`, {}, 'get')
export const updateSensitiveList = (p) => request('sensitive/update', p, 'post')
/**
 * 查询敏感词管理列表
 */
export const getSensitiveRecord = (p) => request('sensitiveRecord/list', p, 'get')
export const delSensitiveRecord = (p) => request(`sensitiveRecord/delete/${p}`, {}, 'get')
// 跨网传输记录
export const getTransferRecord = (p) => request('ferryRecord/list', p, 'get')
export const ferryRecordDelete = (p) => request(`ferryRecord/delete/${p}`, {}, 'get')

// 获取企业云盘文件列表（区分文件路径）
export const getEnterpriseDiskList = (p) => request('file/getEnterpriseDisk', p, 'get')
// 添加至我的云盘
export const addMyFileListApi = (p) => request('file/addFileToMyList', p, 'get')
// 添加至企业云盘
export const addEnterpriseDiskApi = (p) => request('file/addEnterpriseDisk', p, 'get')
