package cn.reghao.tnb.oss.api.iface;

import cn.reghao.jutil.jdk.web.db.PageList;
import cn.reghao.tnb.oss.api.dto.ObjectInfo;
import cn.reghao.tnb.oss.api.dto.disk.DiskVolume;
import cn.reghao.tnb.oss.api.dto.media.AudioInfo;
import cn.reghao.tnb.oss.api.dto.media.ConvertedImageInfo;
import cn.reghao.tnb.oss.api.dto.media.ImageInfo;
import cn.reghao.tnb.oss.api.dto.media.VideoInfo;

import java.util.List;

/**
 * 对 oss-store 进行操作
 * 由 oss-store 实现, oss-console 调用
 *
 * @author reghao
 * @date 2023-08-01 14:51:50
 */
public interface StoreService {
    List<DiskVolume> getDiskVolumes();
    String getUploadToken(int channelCode, int owner, int expire);

    void createChannel(int owner, String channelPrefix, int scope);
    int countChannelObjects(String channelPrefix, int owner);

    void setObjectUpload(String objectId);
    void setObjectScope(String objectId, int scope);
    void deleteByObjectId(String objectId);
    void deleteByObjectName(String objectName, int owner);

    ObjectInfo getObjectInfo(String objectId) throws Exception;
    String getSignedUrl(String domain, int owner, String objectId, int expire) throws Exception;
    String getSignedUrl(String objectUrl, int owner, int expire) throws Exception;

    VideoInfo getVideoInfo(String objectId) throws Exception;
    ImageInfo getImageInfo(String objectId) throws Exception;
    ConvertedImageInfo getWebpInfo(String objectId) throws Exception;
    AudioInfo getAudioInfo(String objectId) throws Exception;

    PageList<ObjectInfo> getByPrefix(int owner, String objectName, int pn, int ps);
}
