/*
 * Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
 *
 */
package net.northking.cctp.attachment.api.service;

import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.vo.ResponseVO;
import net.northking.cctp.attachment.dto.ChunkFiles;
import net.northking.cctp.attachment.dto.FileMessage;
import net.northking.cctp.common.enums.FileBusinessTypeEnum;
import net.northking.cctp.common.http.ResultWrapper;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 附件下载服务
 *
 * @author : xiusong.xie
 * @version : 1.0
 */
public interface AttachFileService
{
  /**
   * 下载
   *
   * @param fileId   文件ID
   * @param response response
   */
  void download(String fileId, HttpServletResponse response, HttpServletRequest request);


  /**
   * 下载
   *
   * @param fileId   文件ID
   * @param response response
   */
  void downloadPub(String fileId, HttpServletResponse response, HttpServletRequest request);

  /**
   * 上传
   *
   * @param response      response
   * @param multipartFile 文件
   * @return 文件ID
   */
  ResultWrapper<String> upload(HttpServletResponse response, MultipartFile multipartFile, String objId, FileBusinessTypeEnum businessCode);

  /**
   * 上传分片文件
   * @param multipartFile 文件
   * @param uploadId      分片上传id
   * @param chunkIndex    分片下标
   * @return
   */
  ResultWrapper<Boolean> uploadChunkFile(MultipartFile multipartFile, String uploadId, String chunkIndex);

  ResultWrapper<String> delete(String fileId);

  /**
   * 合并分片文件
   * @return
   */
  ResultWrapper<String> mergeChunkFiles(ChunkFiles chunkFiles);


  ResultWrapper<Map<String, Object>> uploadResource(HttpServletResponse response, MultipartFile multipartFile, String objId, FileBusinessTypeEnum businessCode, String attachId);

    ResultWrapper<String> update(Map<String, String> file);

  ResultWrapper<FileMessage> uploadForApp(HttpServletResponse response, MultipartFile multipartFile);

  ResultWrapper<String> associatedFiles(String objectId, List<String> fileIds);

    ResultWrapper<String> deleteFileByObjIdAndBusinessCode(String objectId, String businessCode);

  ResponseVO<String> clearAttachments();

    ResultWrapper<String> deleteFileByObjIds(List<String> objectIds);

    ResponseVO<String> clearSceneTaskAttachments(String objId, String businessCode, String noDeleteFileId);
}
