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.dto.atuScript.UserQueryDto;
import net.northking.cctp.scriptcase.dto.component.RecordComTreeDto;
import net.northking.cctp.scriptcase.dto.component.RecordComTreeQueryDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

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

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

    @ApiOperation(value = "查询标签名")
    @PostMapping(value = "/v1/query/findLabelName",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResultWrapper<Map<String, Object>> findLabelName(@RequestBody List<String> ids);

    @ApiOperation(value = "根据名称模糊查询用户ID列表")
    @PostMapping(value = "/v1/query/selectUserId",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public List<String> selectUserId(@RequestBody UserQueryDto userQueryDto);

    @ApiOperation(value = "根据用户姓名模糊查询用户id")
    @PostMapping(value = "/v1/query/selectUserId",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public List<String> findUserIdByName(@RequestBody UserQueryDto query);

    @ApiOperation(value = "录制接口:查看基础组件树模糊搜索")
    @PostMapping(value = "/v1/CpCompLists/feign/getComTreeForLike",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResultWrapper<List<RecordComTreeDto>> getComTreeForLike(@RequestBody RecordComTreeQueryDto query);

    @ApiOperation(value = "feign:获取指定基础组件的信息")
    @PostMapping(value = "/v1/CpCompLists/record/getComInfoByIdList",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResultWrapper<List<RecordComTreeDto>> getComInfoByIdList(@RequestBody List<String> ids);

    @ApiOperation(value = "feign:获取指定基础组件的信息")
    @PostMapping(value = "/v1/CpCompLists/record/getComBasicInfoByIdList",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResultWrapper<List<Map<String,List<String>>>> getComBasicInfoByIdList(@RequestBody List<String> ids);
}
