package com.persagy.server.client

import com.alibaba.fastjson.JSONArray
import com.alibaba.fastjson.JSONObject
import com.fasterxml.jackson.databind.node.ArrayNode
import com.persagy.dmp.basic.config.DigitalFeignConfig
import com.persagy.server.Opts
import com.persagy.server.constant.AdmMiddlewareUrlConstant
import com.persagy.server.datacenter.models.entities.objects.Building
import com.persagy.server.datacenter.models.entities.objects.Component
import com.persagy.server.datacenter.models.entities.objects.Equipment
import com.persagy.server.datacenter.models.entities.objects.Property
import com.persagy.server.datacenter.models.entities.task.BuildingDic
import com.persagy.service.models.requests.SQueryRequest
import com.persagy.service.models.requests.SUpdateRequest
import com.persagy.service.models.responses.SQueryResponse
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 org.springframework.web.bind.annotation.RequestHeader
import javax.swing.text.html.parser.Entity

/**
 * @description:数据中台dmp-rwd 物理世界、数据字典、IOT 接口feign
 * @author:lgy
 * @data:2021/8/11 14:56
 */
@FeignClient(name = "adm-middleware", configuration = [DigitalFeignConfig::class])
interface AdmMiddlewareClient{
    /**
     * @description: 查询建筑列表
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(AdmMiddlewareUrlConstant.BUILDING_QUERY)
    fun queryBuilding(@RequestHeader(defaultValue = "0" ) groupCode: String?, @RequestHeader(defaultValue = "0" ) projectId: String?, @RequestBody criteria: SQueryRequest?): SQueryResponse<Building>?

    /**
     * @description: 查询设备列表
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(AdmMiddlewareUrlConstant.EQUIP_QUERY)
    fun queryEquip(@RequestHeader(defaultValue = "0" ) groupCode: String?, @RequestHeader(defaultValue = "0" ) projectId: String?,@RequestBody criteria: SQueryRequest?): SQueryResponse<JSONObject>?


    /**
     * @description: 更新设备列表
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(AdmMiddlewareUrlConstant.EQUIP_UPDATE)
    fun updateEquip(@RequestHeader(defaultValue = "0" ) groupCode: String?, @RequestHeader(defaultValue = "0" ) projectId: String?, @RequestBody criteria: SUpdateRequest<Equipment>): SUpdateRequest<Equipment>?


    /**
     * @description: 更新设备列表
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(AdmMiddlewareUrlConstant.COMPONENT_UPDATE)
    fun updateComponent(@RequestHeader(defaultValue = "0" ) groupCode: String?, @RequestHeader(defaultValue = "0" ) projectId: String?, @RequestBody criteria: SUpdateRequest<Component>): SUpdateRequest<Component>?


    /**
     * @description: 查询资产列表
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(AdmMiddlewareUrlConstant.PROPERTY_QUERY)
    fun queryProperty(@RequestHeader(defaultValue = "0" ) groupCode: String?, @RequestHeader(defaultValue = "0" ) projectId: String?,@RequestBody criteria: SQueryRequest?): SQueryResponse<JSONObject>?


    /**
     * @description: 更新资产列表
     * @param: objectUrlParam 对象请求url通用参数
     * @param: criteria post请求参数
     * @return: com.persagy.dmp.common.DmpResult
     */
    @PostMapping(AdmMiddlewareUrlConstant.PROPERTY_UPDATE)
    fun updateProperty(@RequestHeader(defaultValue = "0" ) groupCode: String?, @RequestHeader(defaultValue = "0" ) projectId: String?, @RequestBody criteria: SUpdateRequest<Property>): SUpdateRequest<Property>?

}