package com.crm.manager.service;

import com.crm.manager.configuration.FeignMultipartSupportConfig;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.exception.ServiceException;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @description:
 * @author: houn
 * @create: 2020-07-19 16:25
 **/
@FeignClient(name = "GOLDEN-CUSTOM-SERVICE", path = "/custom/file/manager", configuration = FeignMultipartSupportConfig.class)
public interface CustomFileFeignService {

    @PostMapping(value = "/upload/{customId}/{type}", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    BaseResultDto mangerUpload(@RequestPart MultipartFile file, @PathVariable("customId") Long customId, @PathVariable("type") Integer type) throws ServiceException;

    @PostMapping(value = "/upload/{customId}/{type}/{id}", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    BaseResultDto mangerUpload(@RequestPart MultipartFile file, @PathVariable("customId") Long customId, @PathVariable("type") Integer type, @PathVariable("id") Long id) throws ServiceException;
}
