package com.persagy.dmp.digital.client;

import com.persagy.dmp.basic.config.DigitalFeignConfig;
import com.persagy.dmp.basic.dto.RequestData;
import com.persagy.dmp.common.model.response.CommonResult;
import com.persagy.dmp.digital.entity.ObjectRelation;
import org.springframework.cloud.openfeign.FeignClient;
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;

/***
 * Description: 关系计算入口 Client
 * @author : lijie
 * @date :2021/9/3 21:09
 * Update By lijie 2021/9/3 21:09
 */
@FeignClient(name = "dmp-rwd", configuration = DigitalFeignConfig.class,
        url = "${persagy.bdtp.rwd.service:}",path = "/rwd/instance/object/compatible/")
public interface DigitalRelationCaclClient {

    /**
     * 根据项目ID查询设备数量和待报废设备数量统计
     * @param groupCode: 集团编码
     * @param projectId: 项目id
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param requestData: 请求参数
     * @return
     */
    @PostMapping("createObjRelationsByKeywordAndObjType")
    CommonResult<List<ObjectRelation>> createObjRelationsByKeywordAndObjType(@RequestParam("groupCode") String groupCode,
                                                                             @RequestParam("projectId") String projectId,
                                                                             @RequestParam("appId") String appId,
                                                                             @RequestParam("userId") String userId,
                                                                             @RequestBody RequestData requestData);
    /**
     * 根据项目ID查询设备数量和待报废设备数量统计
     * @param groupCode: 集团编码
     * @param projectId: 项目id
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param objectRelation: 请求参数
     * @return
     */
    @PostMapping("deleteObjRelationsByRelId")
    CommonResult<List<ObjectRelation>> deleteObjRelationsByRelId(@RequestParam("groupCode") String groupCode,
                                                                 @RequestParam("projectId") String projectId,
                                                                 @RequestParam("appId") String appId,
                                                                 @RequestParam("userId") String userId,
                                                                 @RequestBody ObjectRelation objectRelation);
    /**
     * 关系计算接口
     * @param groupCode: 集团编码
     * @param projectId: 项目id
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param requestData: 请求参数
     * @return
     */
    @PostMapping("calculatingObjRelation")
    CommonResult<List<ObjectRelation>> calculatingObjRelation(@RequestParam("groupCode") String groupCode,
                                                                 @RequestParam("projectId") String projectId,
                                                                 @RequestParam("appId") String appId,
                                                                 @RequestParam("userId") String userId,
                                                                 @RequestBody RequestData requestData);
}
