package com.persagy.proxy.common.client;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.persagy.dmp.basic.config.DigitalFeignConfig;
import com.persagy.dmp.basic.model.QueryCriteria;
import com.persagy.proxy.common.constant.DmpUrlConstant;
import com.persagy.proxy.common.entity.DmpResult;
import com.persagy.proxy.common.entity.InstanceUrlParam;
import com.persagy.proxy.common.entity.ObjRelationDTO;
import com.persagy.proxy.common.entity.RelationDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 *@description:数据中台dmp-rwd 物理世界、数据字典、IOT 接口feign
 *@author:lgy
 *@data:2021/8/11 14:56
 */
@FeignClient(name = "dmp-rwd", configuration = DigitalFeignConfig.class,url = "${persagy.bdtp.rwd.service:}")
public interface DmpRwdClient {
    /**
     * @description: 查询关系
     * @param: objectUrlParam
     * @param: relationCriteriaList
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.RELATION_QUERY)
    DmpResult<List<ObjRelationDTO>> queryRelation(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody QueryCriteria criteria);

    /**
     * @description: 查询对象列表
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.OBJECT_QUERY)
    DmpResult<JSONArray> queryObject(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
    /**
     * @description: 查询定义类型
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.DEF_CLASS)
    DmpResult<JSONArray> queryDefClass(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);

    /**
     * @description: 创建对象
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.OBJECT_CREATE)
    DmpResult createObject(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONArray objectArr);

    /**
     * @description: 更新对象
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.OBJECT_UPDATE)
    DmpResult updateObject(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONArray objectArr);

    /**
     * @description: 删除对象
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.OBJECT_DELETE)
    DmpResult deleteObject(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody List<String> objectIdList);
    /**
     * @description: 删除关系
     * @param: objectUrlParam
     * @param: relationCriteriaList
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.RELATION_DELETE)
    DmpResult deleteRelation(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);

    /**
     * @description: 创建关系
     * @param: objectUrlParam
     * @param: relationCriteriaList
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.RELATION_CREATE)
    DmpResult createRelation(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody List<RelationDTO> createRelationList);

    /**
     * @description: 查询对象类型
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.DEF_CLASS)
    DmpResult<JSONArray> queryObjectType(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);

    /**
     * @description: 查询信息点
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.DEF_FUNCID)
    DmpResult<JSONArray> queryObjectInfo(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);

    /**
     * @description: 批量修改信息点
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.DEF_FUNCID_UPDATE_BATCH)
    DmpResult batchUpdateObjectInfo(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONArray objectArr);

    /**
     * @description: 批量删除信息点
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.DEF_FUNCID_DEL_BATCH)
    DmpResult<JSONArray> batchDeleteObjectInfo(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody List<String> objectIdList);


    /**
     * @description: 创建关系 标记计算关系
     * @param: objectUrlParam
     * @param: objectArr
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.OBJECT_COMPATIBLE_CREATE)
    DmpResult<List<ObjRelationDTO>> createObjRelations(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONArray objectArr);

    /**
     * @description: 删除关系 标记计算关系
     * @param: objectUrlParam
     * @param: objectArr
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.OBJECT_COMPATIBLE_CREATE)
    DmpResult<List<ObjRelationDTO>> deleteObjRelations(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONArray objectArr);

    /**
     * @description: 创建关系 标记计算关系
     * @param: objectUrlParam
     * @param: objectArr
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.RELATION_PROJECT_CAL_CREATE)
    DmpResult<JSONArray> createRelationProjectCal(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONArray objectArr);

    /**
     * @description: 删除关系 标记计算关系
     * @param: objectUrlParam
     * @param: objectArr
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.RELATION_PROJECT_CAL_DELETE)
    DmpResult<JSONArray> deleteRelationProjectCal(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONArray objectArr);

    /**
     * @description: 更新关系 标记计算关系
     * @param: objectUrlParam
     * @param: objectArr
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.RELATION_PROJECT_CAL_UPDATE)
    DmpResult<JSONArray> updateRelationProjectCal(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONArray objectArr);

    /**
     * @description: 删除关系 标记计算关系
     * @param: objectUrlParam
     * @param: objectArr
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.RELATION_PROJECT_CAL_QUERY)
    DmpResult<JSONArray> queryRelationProjectCal(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);


    /**
     * @description: 查询采集信息点
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.DEF_FUNCID_COLLECT)
    DmpResult<JSONArray> queryObjectInfoCollect(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);


    /**
     * @description: 批量修改信息点
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(DmpUrlConstant.DEF_FUNCID_COLLECT_SET)
    DmpResult batchUpdateObjectInfoCollect(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONArray objectArr);

}