package com.gyee.runeconomy.util.realtimesource.feign;


import com.gyee.common.model.PointData;
import com.gyee.runeconomy.util.realtimesource.timeseries.DoubleStatData;
import feign.Headers;
import feign.Param;
import feign.RequestLine;

import java.util.List;
import java.util.Map;


public interface IAdapterService {


    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /latest?keys={points}")
    Map<String,TsDoubleData> getLatest(@Param(value = "points") String points);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
    List<TsDoubleData> getHistorySnap(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
                                      @Param(value = "endTs") long endTs, @Param(value = "interval") Integer interval);
    
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
    List<TsDoubleData> getValuesByKey(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
                                      @Param(value = "endTs") long endTs, @Param(value = "interval") int interval);
    
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /history/raw?tagName={tagName}&startTs={startTs}&endTs={endTs}")
    List<TsDoubleData> getRawValuesByKey(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
                                         @Param(value = "endTs") long endTs);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /history/section?tagNames={tagNames}&ts={ts}")
    Map<String, TsDoubleData> getHistorySection(@Param(value = "tagNames") String tagNames, @Param(value = "ts") long ts);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /history/stat2?tagName={tagName}&startTs={startTs}&endTs={endTs}")
    Map<String, TsDoubleData> getHistoryStat(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
                                               @Param(value = "endTs") long endTs);


    /**
     * 获取等间隔历史数据
     *
     * @param tagName  测点名称
     * @param startTs  开始时间
     * @param endTs    结束时间
     * @param interval 数据间隔
     * @return 历史数据
     */
    @RequestLine("GET /history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
    List<PointData> getSnapValuesByKey(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
                                       @Param(value = "endTs") long endTs, @Param(value = "interval") int interval);


    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
    List<TsDoubleTsData> getHistorytsSnap(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
                                        @Param(value = "endTs") long endTs, @Param(value = "interval") Integer interval);
}
