package com.backendsys.modules.sdk.douyincloud.tos.service;

import com.backendsys.modules.upload.entity.SysFileResult;
import com.volcengine.tos.model.object.CompleteMultipartUploadV2Output;
import com.volcengine.tos.model.object.CreateMultipartUploadOutput;
import com.volcengine.tos.model.object.ListPartsOutput;
import com.volcengine.tos.model.object.UploadPartV2Output;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * 抖音云 - 对象储存
 * https://cloud.douyin.com/overview
 * 文档首页/对象存储/SDK参考/Java/对象接口/上传对象/普通上传（Java SDK）
 * https://www.volcengine.com/docs/6349/79898
 * 分片上传
 * https://www.volcengine.com/docs/6349/79922
 */
public interface DouyinTosService {

    // [抖音云TOS] 上传对象
    SysFileResult putObject(MultipartFile multipartFile, String object_key) throws IOException;
    // [抖音云TOS] 删除对象
    void deleteObject(String object_key);
    // [抖音云TOS] 批量删除对象
    void deleteObjects(List<String> object_keys);

    // [抖音云TOS] 初始化分块上传
    CreateMultipartUploadOutput initiateMultipartUpload(String object_name);
    // [抖音云TOS] 上传分块
    UploadPartV2Output uploadPart(MultipartFile multipartFile, String upload_id, String object_key, Integer partNumber);
    // [抖音云TOS] 完成分块上传
    CompleteMultipartUploadV2Output completeMultipartUpload(String upload_id, String object_key);

    // [抖音云TOS] 查询已上传的分块
    List<ListPartsOutput> listParts(String upload_id, String object_key);


    // [抖音云TOS] URL 转存
    SysFileResult urlToTOS(String origin_url);
    SysFileResult urlToTOS(String origin_url, String input_suffix);
    SysFileResult urlToTOS(String origin_url, String input_suffix, Long user_id);

}
