package ink.wgink.module.file.service;

import ink.wgink.module.file.enums.UploadTypeEnum;
import ink.wgink.module.file.pojo.dtos.FileDTO;
import ink.wgink.module.file.pojo.dtos.FileInfoDTO;
import ink.wgink.module.file.pojo.vos.FileVO;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.pos.FilePO;
import ink.wgink.pojo.result.SuccessResultList;
import org.springframework.web.multipart.MultipartFile;

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

/**
 * @ClassName: IMinIOService
 * @Description: minIO
 * @Author: wanggeng
 * @Date: 2021/10/17 10:15 上午
 * @Version: 1.0
 */
public interface IMinIoFileService {

    /**
     * 保存
     *
     * @param userId
     * @param fileVO
     * @return
     */
    String saveFileByUserId(String userId, FileVO fileVO);

    /**
     * 删除
     *
     * @param ids
     */
    void remove(List<String> ids);

    /**
     * 物理删除文件
     *
     * @param filePOs 要删除的文件列表
     */
    void deleteFile(List<FilePO> filePOs);

    /**
     * 上传文件
     *
     * @param token
     * @param uploadFile
     * @param uploadTypeEnum
     * @param params
     */
    void uploadFile(String token, MultipartFile uploadFile, UploadTypeEnum uploadTypeEnum, Map<String, Object> params);

    /**
     * 文件上传
     *
     * @param userId         用户ID
     * @param uploadFile
     * @param uploadTypeEnum
     * @param params
     */
    void uploadFileByUserId(String userId, MultipartFile uploadFile, UploadTypeEnum uploadTypeEnum, Map<String, Object> params);

    /**
     * 下载文件
     *
     * @param request
     * @param response
     * @param params
     * @param canRange
     * @return
     */
    boolean downLoadFile(HttpServletRequest request, HttpServletResponse response, Map<String, Object> params, boolean canRange);

    /**
     * 下载文件
     *
     * @param request
     * @param response
     * @param filePO
     * @param isOpen
     * @param canRange
     */
    boolean downLoadFile(HttpServletRequest request, HttpServletResponse response, FilePO filePO, boolean isOpen, boolean canRange);

    /**
     * 文件分页列表
     *
     * @param page
     * @return
     */
    SuccessResultList<List<FileInfoDTO>> listPageInfo(ListPage page);

    /**
     * 文件列表
     *
     * @param idList
     * @return
     */
    List<FileDTO> list(List<String> idList);

    /**
     * 文件列表
     *
     * @param idList
     * @return
     */
    List<FilePO> listPO(List<String> idList);

    /**
     * 详情
     *
     * @param fileId
     * @return
     */
    FilePO getPO(String fileId);

    /**
     * 文件列表
     *
     * @param fileUrl
     * @return
     */
    List<FileDTO> listByUrl(String fileUrl);
}
