package net.northking.cctp.scriptcase.feign;

import io.swagger.annotations.ApiOperation;
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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

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

    @ApiOperation(value = "根据系统id查关联的环境id集合")
    @PostMapping(value = "/v1/query/selectEnvIds",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public List<String> selectEnvIds(@RequestParam("proId") String proId);

    @ApiOperation(value = "feign调用:查询系统内容")
    @GetMapping(value = "/v1/feign/project/data/{proId}")
    public ResultWrapper<Map<String,String>> feignQueryProData(@PathVariable("proId") String proId);

    @ApiOperation(value = "查询系统关联的环境排序")
    @PostMapping(value = "/v1/query/envListSeq",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public List<String> queryEnvListSeq(@RequestParam("proId") String proId);


}
