package com.gyee.frame.common.feign;

import com.alibaba.fastjson.JSONObject;
import com.gyee.frame.model.custom.export.TsPointData;
import com.gyee.frame.util.golden.timeseries.TsData;
import feign.Headers;
import feign.Param;
import feign.RequestLine;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


public interface IAdapterService {


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


    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /ts/history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
    List<TsPointData> 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 /ts/history/raw?tagName={tagName}&startTs={startTs}&endTs={endTs}")
    List<TsPointData> getHistoryRaw(@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 /ts/history/section?tagNames={tagNames}&ts={ts}")
    List<TsPointData> getHistorySection(@Param(value = "tagNames") String tagNames, @Param(value = "ts") long ts);

}
