package com.iailab.sdk.demo;

import com.alibaba.fastjson.JSONObject;
import com.iailab.sdk.auth.client.IailabClient;
import com.iailab.sdk.auth.client.common.pojo.CommonResult;
import com.iailab.sdk.auth.client.common.pojo.PageResult;
import com.iailab.sdk.auth.client.dto.StAlarmAndSuggestPageReqDTO;
import com.iailab.sdk.auth.client.dto.StAlarmAndSuggestRespDTO;
import org.springframework.web.bind.annotation.*;

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


/**
 * @author iailab
 */
@RestController
@RequestMapping("/demo")
public class HttpClientDemo {

    @PostMapping("/query-points/history-value")
    public CommonResult<Map<String, Object>> queryPointsRealValue(@RequestBody List<String> pointNos) {
        return IailabClient.getInstance().queryPointsRealValue(pointNos);
    }

    @PostMapping("/alarm-suggest/page")
    public CommonResult<PageResult<StAlarmAndSuggestRespDTO>> getAlarmAndSuggestPage(@RequestBody StAlarmAndSuggestPageReqDTO reqVO) {
        return IailabClient.getInstance().getAlarmAndSuggestPage(reqVO);
    }

    @GetMapping("/handleHttp")
    public CommonResult<Object> handleHttp(@RequestParam("method") String method, @RequestParam("url") String url, @RequestParam("params") Map<String, Object> params) {
        return IailabClient.getInstance().handleHttp(method,url,params);
    }
}