package cc.smtweb.system.bpm.spring.file.attach;


import cc.smtweb.system.bpm.web.sys.base.attach.AttachInfo;

import javax.servlet.http.HttpServletResponse;
import java.nio.file.Path;
import java.util.List;

/**
 * Created by AKmm at 2011-2-23 16:22:20
 * 附件存储操作接口
 */
public interface IAttachWorkIntf {
    /**
     * 保存附件
     *
     * @param remoteAttachName 远程附件名
     * @param remoteFolderPath 远程路径
     * @param localAttach      本地文件名
     * @param isDelLocal       保存后是否删除本地
     * @throws Exception
     */
    void saveAttach(String remoteAttachName, String remoteFolderPath, String localAttach, boolean isDelLocal) throws Exception;


    /**
     * 复制附件
     *
     * @param srcFileName      源文件
     * @param desFileName      新文件
     * @param remoteFolderPath 文件路径
     * @param isDelSrc         保存后是否删除源文件
     * @throws Exception
     */
    void copyAttach(String srcFileName, String desFileName, String remoteFolderPath, boolean isDelSrc) throws Exception;


    /**
     * 删除路径
     *
     * @param remotePath 远程路径
     * @throws Exception
     */
    void deletePath(String remotePath) throws Exception;

    /**
     * 删除附件
     *
     * @param remotePath 远程路径
     * @param remoteName 远程文件名
     * @return
     */
    void deleteAttach(String remotePath, String remoteName) throws Exception;

    /**
     * 下载附件到文件流
     *
     * @param remotePath
     * @param remoteName
     * @param response
     * @throws Exception
     */
    void downloadAttach(String remotePath, String remoteName, String fileName, HttpServletResponse response) throws Exception;

    /**
     * 下载到本地
     *
     * @param remotePath 远端路径
     * @param remoteName 远端文件
     * @param localPath  本地路径
     * @throws Exception
     */
    void downloadAttach(String remotePath, String remoteName, String localPath) throws Exception;

    /**
     * 下载到本地
     *
     * @param remotePath 远端路径
     * @param remoteName 远端文件
     * @param localPath  本地路径
     * @throws Exception
     */
    void downloadAttach(String remotePath, String remoteName, String localPath, String localName) throws Exception;

    /**
     * img显示
     *
     * @param remotePath 远端路径
     * @param remoteName 远端文件
     * @param response
     * @throws Exception
     */
    void showAttachImg(final String remotePath, final String remoteName, final HttpServletResponse response) throws Exception;

    /**
     * 批量下载文件到本地
     *
     * @param attachlist
     * @param ownerType
     * @param localRoot
     * @return
     * @throws Exception
     */
    List<String> getAttachListFromFtp(List<AttachInfo> attachlist, String ownerType, String localRoot) throws Exception;

    void makeRemoteDir(String path) throws Exception;

    /**
     * 获取文件路径
     */
    Path getAttachPath(String remotePath, String remoteName);
}
