package com.m2pool.system.api;

import com.m2pool.common.core.Result.R;
import com.m2pool.common.core.constant.ServiceNameConstants;
import com.m2pool.system.api.entity.SysFile;
import com.m2pool.system.api.factory.RemoteFileFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件服务
 *
 * @author m2pool
 */
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
public interface RemoteFileService
{
    /**
     * 上传文件
     *
     * @param file 文件信息
     * @return 结果
     */
    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);

    /**
     * windMiner上传文件
     *
     * @param file 文件信息
     * @return 结果
     */
    @PostMapping(value = "/windMinerUploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public R<SysFile> windMinerUploadFile(@RequestPart(value = "file") MultipartFile file);
}

