package com.ho.business.feignclient;

import com.ho.business.entity.DeviceTypeCol;
import com.ho.business.vo.DeviceTypeList;
import com.ho.common.tools.constant.ContextConstant;
import com.ho.common.tools.entity.ProcessOrder;
import com.ho.common.tools.exception.DataResult;
import com.ho.flow.vo.Event;
import com.ho.flow.vo.req.AlarmConfig.AlarmConfigQueryVo;
import com.ho.flow.vo.req.SendSmsConfig.SendSmsConfigQueryReq;
import com.ho.flow.vo.req.event.EventAddReq;
import com.ho.flow.vo.req.event.EventDemoReqVo;
import com.ho.flow.vo.req.event.EventReqPageVO;
import com.ho.flow.vo.resp.StationStatusRespVO;
import com.ho.flow.vo.resp.event.EventDayNum;
import com.ho.flow.vo.resp.event.EventDemo;
import com.ho.flow.vo.resp.event.EventTypeAndLevelsReqVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Description Flow远程调用
 * Author yule
 * Date 2023/2/15 17:53
 */
@FeignClient(value = ContextConstant.FLOW_CENTER, fallback = FlowFeignClientFallback.class)
public interface FlowFeignClient {

    //根据电站id查询工单数据
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/selectWorkOrderByStationId")
    DataResult<Integer> selectWorkOrderByStationId(@RequestBody Integer stationId);


    //新增告警数据入库
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/addEvents")
    DataResult addEvents(@RequestBody EventAddReq event);

    /**
     * 多个设备批量增加告警入库
     * @param event
     * @return
     */
    @PostMapping(value = ContextConstant.ROOT_CONTEXT +ContextConstant.FLOW_CONTEXT + "outerApi/addEventsList")
    DataResult addEventsList(@RequestBody List<EventAddReq> event);

    //新增告警数据入库
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/isRecoveryDevice")
    Boolean isRecoveryDevice(@RequestBody AlarmConfigQueryVo alarmConfigQueryVo);

    //故障电站统计(同一集团)
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/isNormalStation")
    DataResult<List<StationStatusRespVO>> normalStation(@RequestBody AlarmConfigQueryVo alarmConfigQueryVo);

    //统计故障开始结束时间
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/faultDuration")
    DataResult<List<EventDemo>> faultDuration(@RequestBody EventDemoReqVo eventDemoReqVo);

    //统计故障开始结束时间
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/faultDurations")
    DataResult<List<EventDemo>> faultDurations(@RequestBody EventDemoReqVo eventDemoReqVo);


    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/deviceColDefine")
    DataResult deviceColDefine(@RequestBody List<DeviceTypeCol> deviceTypeCols);

    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/syncAlarmConfig")
    DataResult syncAlarmConfig(@RequestBody DeviceTypeList deviceTypeList);

    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/getNotRecovered")
    DataResult<Event> getNotRecovered(@RequestBody AlarmConfigQueryVo stationStatusReq);

    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/alarmDataStatistics")
    DataResult<EventTypeAndLevelsReqVO> alarmDataStatistics(@RequestBody AlarmConfigQueryVo stationStatusReq);

    //发短信
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/getSendSms")
    DataResult getSendSms(@RequestBody SendSmsConfigQueryReq vo);

    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/countEventByDay")
    List<EventDayNum> countEventByDay(@RequestBody EventReqPageVO vo);

    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FLOW_CONTEXT + "outerApi/initProcessInstance")
    DataResult initProcessInstance(@RequestBody ProcessOrder processOrder);
}
