package com.yifu.cloud.plus.v1.batch.service;

import com.yifu.cloud.plus.v1.batch.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.FileVo;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * 文件上传
 *
 * @author pwang
 * @date 2022-07-27 16:16:07
 */
public interface FileUploadService {

	R<FileVo> uploadImg(MultipartFile file, String filePath, String type, String domain) throws IOException;

	R<TAttaInfo> uploadFileReturnAtta(MultipartFile file, String filePath, String type, String domainId) throws IOException;

	R<TAttaInfo> uploadFileReturnAtta(MultipartFile file, String filePath, String type, String domainId, String taskId) throws IOException;

	/**
	 * 上传文件并返回附件信息（支持传递用户ID，用于异步场景）
	 *
	 * @param file     文件
	 * @param filePath 文件路径
	 * @param type     类型
	 * @param domainId 域ID
	 * @param taskId   任务ID
	 * @param userId   用户ID
	 * @param userName 用户名
	 * @return 附件信息
	 * @throws IOException IO异常
	 */
	R<TAttaInfo> uploadFileReturnAtta(MultipartFile file, String filePath, String type, String domainId, String taskId, String userId, String userName) throws IOException;

	R<T> uploadAsso(MultipartFile file, String filePath, String type, String domain, String uploadType);

	R<T> uploadAsso(MultipartFile file, String filePath, String type, String domain, String uploadType, String taskId);

	/**
	 * 检查文件是否存在
	 *
	 * @param filePath 文件路径
	 * @return 是否存在
	 */
	boolean checkFileExists(String filePath);
}
