package com.gyee.generation.config.feign;

import com.gyee.common.model.PointData;
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("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("tagName") String tagName,
            @Param("startTs") long startTs,
            @Param("endTs") long endTs,
            @Param("interval") Integer interval
    );

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

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

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

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

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
    List<PointData> getSnapValuesByKey(
            @Param("tagName") String tagName,
            @Param("startTs") long startTs,
            @Param("endTs") long endTs,
            @Param("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("tagName") String tagName,
            @Param("startTs") long startTs,
            @Param("endTs") long endTs,
            @Param("interval") Integer interval
    );
}
