package com.ycwl.basic.storage.adapters;

import com.ycwl.basic.storage.entity.StorageConfig;
import com.ycwl.basic.storage.entity.StorageFileObject;
import com.ycwl.basic.storage.enums.StorageAcl;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.InputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface IStorageAdapter {
    void loadConfig(Map<String, String> config);
    void setConfig(StorageConfig config);
    String uploadFile(String contentType, InputStream inputStream, String ...path);
    String uploadFile(String contentType, File file, String ...path);
    String uploadFile(MultipartFile file, String ...path);
    boolean deleteFile(String ...path);
    String getUrl(String ...path);
    String getUrlForDownload(String ...path);
    String getUrlForDownload(Date expireDate, String ...path);
    String getUrlForUpload(String ...path);
    String getUrlForUpload(Date expireDate, String contentType, String... path);
    List<StorageFileObject> listDir(String ...path);
    boolean deleteDir(String ...path);
    boolean setAcl(StorageAcl acl, String ...path);

    boolean isExists(String ...path);
}
