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 net.northking.cctp.scriptcase.feign.dto.AtuExceptionCase;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
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.RequestBody;

import java.util.List;

@FeignClient(name = "atu-execute-plan", path = "/atu-execute-plan", configuration = {FeignCctpConfig.class})
public interface ExecutePlanFeignClient {
    @ApiOperation(value = "feign:判断用例集是否被执行计划引用")
    @PostMapping(value = "/pub/execPlan/isUse",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Boolean isUse(List<String> setIds);

    @ApiOperation(value = "批次用例推送通知")
    @PostMapping(value = "/pub/execPlan/casePushNotice")
    public ResultWrapper<Boolean> casePushNotice(@Validated @RequestBody List<AtuExceptionCase> exceptionCaseList);

    @ApiOperation(value = "feign调用:根据计划id查询关联脚本id")
    @GetMapping(value = "/v1/feign/query/scriptList/{planId}")
    public ResultWrapper<List<String>> queryScriptLinkByPlan(@PathVariable("planId") String planId);

    @ApiOperation(value = "根据脚本id查询是否有关联")
    @PostMapping(value = "/v1/check/scriptByPlan")
    public Boolean checkScript(@RequestBody List<String> ids);

    @ApiOperation(value = "根据脚本id查询用例集是否有关联")
    @PostMapping(value = "/v1/check/dataSet")
    Boolean checkDataSetUsedByScriptIdList(@RequestBody List<String> scriptIdList);
}
