package net.northking.cctp.executePlan.feign;

import io.swagger.annotations.ApiOperation;
import net.northking.cctp.common.feign.FeignCctpConfig;
import net.northking.cctp.common.http.ResultWrapper;
import net.northking.cctp.executePlan.dto.planScript.AtuPlanScriptSaveDto;
import net.northking.cctp.executePlan.dto.planTask.AtuPlanInputDto;
import net.northking.cctp.executePlan.feign.dto.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

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

/**
 * <p>Title: ScriptCaseFeignClient</p>
 * <p>Description: 脚本用例服务</p>
 *
 * @Author chenjianfeng
 * @Version V1.0
 * @Date 2022/12/09
 * <p>Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.</p>
 */
@FeignClient(name = "atu-script-case", path = "/atu-script-case", configuration = {FeignCctpConfig.class})
public interface ScriptCaseFeignClient {

    @ApiOperation(value = "根据场景脚本id查询节点脚本")
    @PostMapping(value = "/v1/scene/query/scriptByScene")
    public ResultWrapper<Map<String,Object>> querySceneScript(@RequestBody Map<String,Object> sceneId);

    @ApiOperation(value = "feign调用：校验计划数据是否正常")
    @PostMapping(value = "/v1/script/feign/plan/checkData")
    public ResultWrapper<Map<String,Object>> checkPlanByCaseSet(@RequestBody @Validated AtuScriptInfoFeignDto dto);

    @ApiOperation(value = "feign调用：校验脚本类型")
    @PostMapping(value = "/v1/script/feign/script/checkData")
    public ResultWrapper<AtuScriptInfoResultDto> checkScriptData(@RequestBody @Validated List<String> scriptList);



    @ApiOperation(value = "feign调用：校验脚本类型")
    @PostMapping(value = "/v1/script/feign/query/ScriptData")
    public PlanScriptPageDto queryScriptByPlan(@RequestBody @Validated PlanPageQueryDto queryDto);

    @ApiOperation(value = "feign调用:查询计划勾选的脚本")
    @PostMapping(value = "/v1/feign/query/scriptId",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public List<AtuPlanScriptReturnDto> feignQueryScriptId(@RequestBody AtuPlanScriptSaveDto dto);

    @ApiOperation(value = "数据列表查询")
    @PostMapping(value = "/v1/script/feign/queryCode")
    public String queryScriptCode(@RequestBody Map<String,String> scriptMap);

    @ApiOperation(value = "feign调用:查询业务组件名称")
    @PostMapping(value = "/v1/query/busComNameMap")
    public ResultWrapper<Map<String, String>> queryBusComNameMap(@RequestBody List<String> comIdList);

    @ApiOperation(value = "feign调用:根据环境和脚本查询输入项数据")
    @PostMapping(value = "/v1/atuInputSet/query/queryInputByEnvIdAndScriptIdMap")
    public ResultWrapper<List<AtuPlanInputDto>> queryInputByEnvIdAndScriptIdMap(@RequestBody Map<String, List<String>> envScriptMap);
}
