package com.persagy.dmp.codetable.client;

import com.persagy.dmp.basic.config.DigitalFeignConfig;
import com.persagy.dmp.basic.dto.RequestData;
import com.persagy.dmp.codetable.entity.CodeTableData;
import com.persagy.dmp.common.model.response.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "dmp-dic", configuration = DigitalFeignConfig.class,
        url = "${persagy.bdtp.dic.service:}",path = "/dic/code")
public interface CodeTableDataClient {

    /**
     * 根据码表类型查询所有字典数据
     * @param groupCode 集团编码
     * @param projectId 项目ID
     * @param appId 应用ID
     * @param userId 用户ID
     * @param typeCode 码表类型编码
     * @return List<CodeTableData>
     */
    @PostMapping("/queryAll/{typeCode}")
    CommonResult<List<CodeTableData>> queryCodeTableDetailListByTypeCode(
            @RequestParam("groupCode") String groupCode,
            @RequestParam("projectId") String projectId,
            @RequestParam("appId") String appId,
            @RequestParam("userId") String userId,
            @PathVariable String typeCode);
    /**
     * 根据码表类型及码表数据code查询字典详情
     * @param groupCode 集团编码
     * @param projectId 项目ID
     * @param appId 应用ID
     * @param userId 用户ID
     * @param requestData 请求参数
     * @return List<CodeTableData>
     */
    @PostMapping("/queryCodeTableDatasByTypeCodeAndCodes")
    CommonResult<List<CodeTableData>> queryCodeTableDatasByTypeCodeAndCodes(
            @RequestParam("groupCode") String groupCode,
            @RequestParam("projectId") String projectId,
            @RequestParam("appId") String appId,
            @RequestParam("userId") String userId,
            @RequestBody RequestData requestData);
    /**
     * 根据码表类型及父码表code查询其下的码表数据
     * @param groupCode 集团编码
     * @param projectId 项目ID
     * @param appId 应用ID
     * @param userId 用户ID
     * @param requestData 请求参数
     * @return List<CodeTableData>
     */
    @PostMapping("/queryCodeTableDatasByParentCode")
    CommonResult<List<CodeTableData>> queryCodeTableDatasByParentCode(
            @RequestParam("groupCode") String groupCode,
            @RequestParam("projectId") String projectId,
            @RequestParam("appId") String appId,
            @RequestParam("userId") String userId,
            @RequestBody RequestData requestData);

}
