package com.njcn.event.api;

import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.event.api.fallback.EventDetailFeignClientFallbackFactory;
import com.njcn.event.pojo.param.EventCountParam;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.GeneralVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * @author denghuajun
 * @version 1.0.0
 * @date 2022/3/16
 */
@FeignClient(value = ServerInfo.EVENT,path = "/event",fallbackFactory = EventDetailFeignClientFallbackFactory.class)
public interface EventDetailFeignClient {

    /**
     * 根据监测点id获取暂降事件
     * @param id 监测点id
     * @return 暂降事件信息
     */
    @PostMapping("/getEventDetailData")
    HttpResult<List<EventDetail>> getEventDetailData(@RequestParam("id")String id, @RequestParam("startTime")String startTime, @RequestParam("endTime")String endTime);

    /**
     * 根据监测点集合获取暂降事件
     * @return 暂降事件信息
     */
    @PostMapping("/getEventDetail")
    HttpResult<List<EventDetail>> getEventDetail(@RequestBody List<String> lineIndexes, @RequestParam("startTime")String startTime, @RequestParam("endTime")String endTime);

    /**
     * 根据监测点集合分页获取暂降事件
     * @return 暂降事件信息
     */
    @PostMapping("/getEventDetailLimit")
    HttpResult<List<EventDetail>> getEventDetailLimit(@RequestBody List<String> lineIndexes, @RequestParam("startTime")String startTime, @RequestParam("endTime")String endTime,@RequestParam("pageSize") Integer pageSize,@RequestParam("pageNum") Integer pageNum);

    /**
     * 根据监测点集合获取短时终端，电压暂升，电压暂降数量
     * @return 暂降事件信息
     */
    @PostMapping("/getEventDetailCount")
    HttpResult<List<GeneralVO>> getEventDetailCount(@RequestBody Map<String, Object> condMap);

    /**
     * 根据暂态id集合获取暂降列表
     */
    @PostMapping("/getEventDetailByIdsList")
    HttpResult<List<RmpEventDetailPO>> getEventDetailByIdsList(@RequestBody List<String> ids);

    /**
     * 根据监测点id集合,统计时间范围内暂态超标次数
     */
    @PostMapping("/getEventDetailByLineCount")
    HttpResult<Integer> getEventDetailByLineCount(@RequestBody EventCountParam param);

    /**
     * 根据监测点id集合,统计时间范围内特征增幅小于0.9的暂态信息
     */
    @PostMapping("/getAppEventDetailLtAmplitude")
    HttpResult<List<RmpEventDetailPO>> getAppEventDetailLtAmplitude(@RequestBody EventCountParam param);

    /**
     * 根据监测点id集合和统计类型,查询暂态信息
     */
    @PostMapping("/getEventDetailByEventType")
    HttpResult<List<RmpEventDetailPO>> getEventDetailByEventType(@RequestBody EventCountParam param);

    /**
     * 根据开始时间及结束时间获取暂态事件信息
     */
    @PostMapping("/getNewEventDetailByTime")
    HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(@RequestBody EventCountParam param);
}
