package com.njcn.device.biz.commApi;

import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.biz.commApi.fallback.CommTerminalGeneralClientFallbackFactory;
import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.param.MonitorGetParam;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;
import java.util.Map;

/**
 * @author cdf
 * @date 2023/4/24
 */
@FeignClient(
        value = ServerInfo.DEVICE,
        path = "commTerminal",
        contextId = "commTerminal",
        fallbackFactory = CommTerminalGeneralClientFallbackFactory.class)
public interface CommTerminalGeneralClient {


    /**
     * 通过部门获取所有子级部门详情
     *
     * @author cdf
     * @date 2023/5/15
     */
    @PostMapping("getDeptChildrenByParent")
    HttpResult<List<DeptGetBase>> getDeptChildrenByParent(@RequestBody @Validated DeptGetLineParam deptGetLineParam);


    /**
     * 根据单位获取监测点信息
     *
     * @author cdf
     * @date 2023/5/10
     */
    @PostMapping("deptGetLine")
    HttpResult<List<DeptGetChildrenMoreDTO>> deptGetLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam);

    @PostMapping("deptGetLineInfo")
    HttpResult<List<MonitorCommLedgerInfoDTO>> deptGetLineInfo(@RequestBody @Validated DeptGetLineParam deptGetLineParam);


    @PostMapping("deptGetAllLine")
    HttpResult<List<DeptGetChildrenMoreDTO>> deptGetAllLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam);


    /**
     * 根据单位获取所有变电站
     *
     * @author cdf
     * @date 2023/5/10
     */
    @PostMapping("deptGetSubStation")
    HttpResult<List<DeptGetSubStationDTO>> deptSubStation(@RequestBody @Validated DeptGetLineParam deptGetLineParam);

    /**
     * 根据单位获取所有变电站详细信息
     *
     */
    @PostMapping("/deptGetSubStationInfo")
    HttpResult<List<DeptGetSubStationDTO.Info>> deptGetSubStationInfo(@RequestBody @Validated DeptGetLineParam deptGetLineParam);

    /**
     * 根据单位获取所有母线
     *
     * @author cdf
     * @date 2023/5/10
     */
    @PostMapping("deptGetBusBar")
    HttpResult<List<DeptGetBusBarDTO>> deptBusBar(@RequestBody @Validated DeptGetLineParam deptGetLineParam);


    /**
     * 根据单位获取所有装置
     *
     * @author cdf
     * @date 2023/5/10
     */
    @PostMapping("deptGetDevice")
    HttpResult<List<DeptGetDeviceDTO>> deptGetDevice(@RequestBody @Validated DeptGetLineParam deptGetLineParam);

    /**
     * @Description: 根据单位获取单位下的装置以及装置下的监测点
     * @Author: wr
     * @Date: 2023/9/25 10:30
     */
    @PostMapping("deptGetDeviceAndMonitor")
    HttpResult<List<DeptGetDeviceDTO>> deptGetDeviceAndMonitor(@RequestBody @Validated DeptGetLineParam deptGetLineParam);

    /**
     * 根据单站id获取监测点信息
     *
     * @author cdf
     * @date 2023/5/10
     */
    @PostMapping("substationGetLine")
    HttpResult<LineDevGetBandDTO> substationGetLine(@RequestParam("substationId") String substationId);


    /**
     * 根据母线id获取监测点信息
     *
     * @author cdf
     * @date 2023/5/10
     */
    @PostMapping("busBarGetLine")
    HttpResult<List<LineDevGetDTO>> busBarGetLine(@RequestParam("busBarId") String busBarId);


    /**
     * 通过部门获取所有子集部门所拥有的监测点
     *
     * @param deptGetLineParam
     * @return 指定的部门监测点信息
     */
    @PostMapping("/deptGetLineIds")
    HttpResult<List<DeptGetChildrenDTO>> deptGetLineList(@RequestBody DeptGetLineParam deptGetLineParam);


    /**
     * @param id
     * @Description: 获取监测点限值
     * @Author: wr
     * @Date: 2023/9/21 10:56
     */
    @PostMapping("/getOverLimitData")
    HttpResult<Overlimit> getOverLimitData(@RequestParam("id") String id);

    /**
     * @Description: 获取所有监测点限值
     * @Author: wr
     * @Date: 2023/9/21 10:56
     */
    @PostMapping("/getAllLineOverLimit")
    HttpResult<List<Overlimit>> getAllLineOverLimit();

    @PostMapping("/getOverLimitDataByIds")
    HttpResult<List<Overlimit>> getOverLimitDataByIds(@RequestBody List<String> ids);

    /**
     * @Description: 获取变电站下监测点信息
     * @param devDataType
     * @Author: wr
     * @Date: 2023/9/21 13:27
     */
    @PostMapping("/getLineBySubstationRelation")
    HttpResult<Map<String, List<String>>> getLineBySubstationRelation(@RequestParam("devDataType") Integer devDataType);

    @GetMapping("/getRunMonitorIds")
    HttpResult<List<String>> getRunMonitorIds();


    @PostMapping("/getMonitorDetailList")
    HttpResult<List<LineDevGetDTO>> getMonitorDetailList(@RequestBody List<String> list);


    @GetMapping("/lineUnitDetail")
    HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId);


    @GetMapping("/getMonitorDetail")
    HttpResult<LineDevGetDTO> getMonitorDetail(@RequestParam("lineId") String lineId);

    /**
     * @Description: 专项分析台账统计
     * @param param
     * @Author: wr
     * @Date: 2023/10/13 14:05
     */
    @PostMapping("/getStatisticsMonitor")
    HttpResult<List<StatisticsMonitor>> getStatisticsMonitor(@RequestBody StatisticsBizBaseParam param);


    @GetMapping("/getCustomDetailByLineId")
    HttpResult<Map<String,String>> getCustomDetailByLineId(@RequestParam("id") String id);

    /**
     * pms获取指定单位下面的母线以及母线下面的监测点信息
     * @author cdf
     * @date 2024/1/26
     */
    @GetMapping("/getBusBarAndHisMonitor")
    HttpResult<List<BusBarAndHisMonitorDTO>> getBusBarAndHisMonitor();


    @PostMapping("/tagOrIdGetMonitorList")
    HttpResult<List<CommMonitorInfoDTO>> tagOrIdGetMonitorList(@RequestBody MonitorGetParam monitorGetParam);


    /**
     * 获取变电站信息
     * @param substationParam
     * @return
     */
    @PostMapping("/tagOrIdGetSub")
    HttpResult<List<SubGetBase>>  tagOrIdGetSub(@RequestBody SubstationParam substationParam);





    /**
     * 用于返回pq 还是pms系统
     *
     * @author cdf
     * @date 2023/8/3
     */
    @GetMapping("isPqOrPms")
    HttpResult<String> isPqOrPms();

}
