package cd.casic.module.terminal.service;

import org.springframework.web.multipart.MultipartFile;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;

import java.io.IOException;

/**
 * SFTP 操作 服务类
 *
 * @author Jiahang Li
 * @version 1.0.0
 * @since 2023-12-26 22:09
 */
public interface TerminalSftpService {

    /**
     * 设置文件内容
     *
     * @param token    token
     * @param response response
     * @throws IOException IOException
     */
    void getFileContentByToken(String token, HttpServletResponse response) throws IOException;

    /**
     * 获取文件内容
     *
     * @param token token
     * @param file  file
     * @throws IOException IOException
     */
    void setFileContentByToken(String token, MultipartFile file) throws IOException;

    /**
     * 通过 transferToken 下载
     *
     * @param channelId     channelId
     * @param transferToken transferToken
     * @param response      response
     * @return body
     */
    StreamingResponseBody downloadWithTransferToken(String channelId,
                                                    String transferToken,
                                                    HttpServletResponse response);

}
