package com.sptg.third.api.feigns.topsailiot;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.third.api.entity.topsailiot.TopsailDevice;
import com.sptg.third.api.entity.topsailiot.TopsailDeviceConfig;
import com.sptg.third.api.feigns.topsailiot.fallback.TopsailFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author zwx
 * @create 2020/12/6 0:58
 */
@FeignClient(value = "smart-house-third", fallbackFactory = TopsailFeignFallbackFactory.class)
public interface TopsailFeign {

    /**
     * 获取项目列表
     * @return
     */
    @GetMapping(value = "/topsail/iot/getProjectList")
    public ResultBean<String> getProjectList();

    /**
     * 批量查询设备最新数据
     * @param projectId
     * @return
     */
    @GetMapping(value = "/topsail/iot/getDeviceDatas/{projectId}")
    public ResultBean<String> getDeviceDatas(@PathVariable(value = "projectId") Integer projectId);

    /**
     * 查询单个设备最新数据
     * @param deviceId
     * @return
     */
    @GetMapping(value = "/topsail/iot/getDeviceByDeviceId/{deviceId}")
    public ResultBean<String> getDeviceByDeviceId(@PathVariable(value = "deviceId") String deviceId);

    /**
     * 查询单个设备历史数据
     * @param deviceId
     * @return
     */
    @GetMapping(value = "/topsail/iot/getDevicesHistoryByDeviceId/{deviceId}")
    public ResultBean<String> getDevicesHistoryByDeviceId(@PathVariable(value = "deviceId") String deviceId);

    /**
     * 批量查询最新预警信息
     * @param projectId
     * @return
     */
    @GetMapping(value = "/topsail/iot/getDevicesAlarms/{projectId}")
    public ResultBean<String> getDevicesAlarms(@PathVariable(value = "projectId") Integer projectId);

    /**
     * 单个设备预警历史
     * @param deviceId
     * @return
     */
    @GetMapping(value = "/topsail/iot/getDevicesAlarmByDeviceId/{deviceId}")
    public ResultBean<String> getDevicesAlarmByDeviceId(@PathVariable(value = "deviceId") String deviceId);

    /**
     * 批量设备配置信息获取
     * @param topsailIotDevice
     * @return
     */
    @PostMapping(value = "/topsail/iot/getDevicesConfigs")
    public ResultBean<String> getDevicesConfigs(@RequestBody TopsailDevice topsailIotDevice);

    /**
     * 单个设备配置下发
     * @param deviceId
     * @return
     */
    @PostMapping(value = "/topsail/iot/sendDevicesConfigByDeviceId/{deviceId}")
    public ResultBean<String> sendDevicesConfigByDeviceId(@PathVariable(value = "deviceId") String deviceId, @RequestBody TopsailDeviceConfig topsailDeviceConfig);

    /**
     * 某设备配置信息查询
     * @param imei
     * @return
     */
    @GetMapping(value = "/topsail/iot/getDeviceConfigData/{imei}")
    public ResultBean<String> getDeviceConfigData(@PathVariable(value = "imei") String imei);
}
