package com.njcn.device.api;

import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.api.fallback.LineFeignClientFallbackFactory;
import com.njcn.device.pojo.dto.*;
import com.njcn.device.pojo.po.Line;
import com.njcn.device.pojo.po.Overlimit;
import com.njcn.device.pojo.vo.*;
import org.apache.commons.collections.map.MultiValueMap;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.xml.transform.Result;
import java.util.List;

/**
 * @author denghuajun
 * @date 2022/2/28
 */
@FeignClient(value = ServerInfo.DEVICE, path = "/line", fallbackFactory = LineFeignClientFallbackFactory.class)
public interface LineFeignClient {

    /**
     * 获取终端状态信息
     *
     * @param id              监测点id
     * @param searchBeginTime 起始时间
     * @param searchEndTime   结束时间
     * @return 终端状态信息
     */
    @PostMapping("/getComFlagInfoData")
    HttpResult<CommunicateVO> getComFlagInfoData(@RequestParam("id") String id,
                                                 @RequestParam("searchBeginTime") String searchBeginTime,
                                                 @RequestParam("searchEndTime") String searchEndTime);

    /**
     * 根据监测点id获取 终端id
     *
     * @param id 监测点id
     * @return 终端id
     */
    @PostMapping("getLineIdByDevId")
    HttpResult<String> getLineIdByDevId(@RequestParam("id") String id);

    /**
     * 根据监测点id获取限值
     *
     * @param id 监测点id
     * @return 获取限值
     */
    @PostMapping("getOverLimitData")
    HttpResult<Overlimit> getOverLimitData(@RequestParam("id") String id);

    /**
     * 根据监测点id获取监测点详情
     *
     * @param id 监测点id
     * @return 监测点详情
     */
    @PostMapping("getLineDetailData")
    HttpResult<LineDetailDataVO> getLineDetailData(@RequestParam("id") String id);

    /**
     * 根据监测点id获取监测点越限
     *
     * @param id 监测点id
     * @return 监测点越限详情
     */
    @PostMapping("getLineOverLimitData")
    HttpResult<LineOverLimitVO> getLineOverLimitData(@RequestParam("id") String id);


    /**
     * 获取投运在线的监测点的限值
     *
     * @param serverName 服务名称
     * @param deptId     部门id
     * @return 监测点越限详情
     */
    @PostMapping("/getAllLineOverLimit")
    HttpResult<List<Overlimit>> getAllLineOverLimit(@RequestParam("serverName") String serverName, @RequestParam(value = "deptId", required = false) String deptId);

    /**
     * 获取变电站详情
     *
     * @param id 变电站id
     * @return 结果
     */
    @PostMapping("getSubstationData")
    HttpResult<List<SubstationDetailVO>> getSubstationData(@RequestParam("id") List<String> id);

    /**
     * 根据变电站id获取子节数据
     *
     * @param id 变电站id
     * @return 结果
     */
    @PostMapping("getSubIndexLineDetail")
    HttpResult<List<Line>> getSubIndexLineDetail(@RequestParam("id") String id);

    /**
     * 获取所有监测点
     * @param id 监测点集合
     * @return 结果
     */
    @PostMapping("getAllLine")
    HttpResult<List<LineDeviceStateVO>> getAllLine(@RequestBody List<String> id);

    /**
     * 获取终端状态
     * @param id id
     * @return 结果
     */
    @PostMapping("getDeviceState")
    HttpResult<Integer> getDeviceState(@RequestParam("id") String id);

    /**
     * 获取变电站信息
     * @param id id
     * @return 结果
     */
    @PostMapping("getSubstationInfo")
    HttpResult<PollutionSubstationDTO> getSubstationInfo(@RequestParam("id") String id);

    /**
     * 获取监测点信息
     * @param  pollutionParamDTO 监测点对象
     * @return 结果
     */
    @PostMapping("getLineInfo")
    HttpResult<List<PollutionLineDTO>> getLineInfo(@RequestBody PollutionParamDTO pollutionParamDTO);

    /**
     * 获取所有监测点
     * @param id 监测点集合
     * @return 结果
     */
    @PostMapping("getLineSubGdDetail")
    HttpResult<LineDetailVO> getLineSubGdDetail(@RequestParam("id") String id);

    /**
     * 获取告警变电站信息
     * @param list 变电站集合
     * @return 结果
     */
    @PostMapping("getWarningSub")
    HttpResult<List<WarningSubstationDTO>> getWarningSub(@RequestParam("list") List<String> list);

    /**
     * 获取监测点信息
     * @param pollutionParamDTO 实体
     * @return 结果
     */
    @PostMapping("getOverLimitLineInfo")
    HttpResult<List<OverLimitLineDTO>> getOverLimitLineInfo(@RequestBody PollutionParamDTO pollutionParamDTO);

    /**
     * 获取生成limitRate的监测点
     * @return 监测点id集合
     */
    @PostMapping("getLineList")
    HttpResult<List<String>> getLineList();

    /**
     * 获取监测点限值
     * @param  pollutionParamDTO 监测点id集合
     * @return 监测点限值信息
     */
    @PostMapping("getOverLimitByList")
    HttpResult<List<Overlimit>> getOverLimitByList(@RequestBody PollutionParamDTO pollutionParamDTO);
}
