package net.northking.cctp.scriptcase.feign;

import io.swagger.annotations.ApiParam;
import net.northking.cctp.common.dto.AssociatedFilesDto;
import net.northking.cctp.common.feign.FeignCctpConfig;
import net.northking.cctp.common.http.ResultWrapper;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@FeignClient(name = "cctp-files", path = "/cctp-files", configuration = {FeignCctpConfig.class})
public interface AttachmentFeignClient {

    @PostMapping(value = "/v1/update",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultWrapper<String> update(Map<String,String> file);

    @PostMapping(value = "/pub/associatedFiles")
    ResultWrapper<String> associatedFiles(@ApiParam(value = "关联文件请求对象") @RequestBody AssociatedFilesDto associatedFilesDto);

    @GetMapping(value = "/pub/deleteFileByObjIdAndBusinessCode")
    ResultWrapper<String> deleteFileByObjId(@RequestParam("objectId") String objectId, @RequestParam("businessCode") String businessCode);

}
