package com.huimv.datacollection.feign;

import com.huimv.common.utils.R;
import com.huimv.datacollection.config.FeignLogConfig;
import com.huimv.datacollection.entity.IndoorEnvironmentEntity;
import com.huimv.datacollection.entity.WarningInfoEntity;
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;

import java.util.Map;

/**
 * <p>
 * 微服务management提供feign接口
 * </p>
 *
 * @author yinhao
 * @date 2021/7/6 9:24
 */
@FeignClient(value = "huimv-smart-management",configuration = FeignLogConfig.class)
public interface ManagementFeignService {

    /**
     * 设备信息
     * @param deviceId
     * @return
     */
    @GetMapping("/management/device/info/{deviceId}")
    R deviceInfo(@PathVariable("deviceId") String deviceId);

    /**
     * 根据类型查询阈值
     *
     * @param type
     * @return
     */
    @GetMapping("/management/thresholdManagement/selectByType/{type}")
    Map<String, Double> selectByType(@PathVariable("type") Short type);

    /**
     * 保存报警信息
     * @param warningInfo
     * @return
     */
    @PostMapping("/management/warningInfo/save")
    R saveWarningInfo(@RequestBody WarningInfoEntity warningInfo);

    /**
     * 保存室内环境数据
     * @param indoorEnvironment
     * @return
     */
    @PostMapping("/management/indoorEnvironment/save")
    R saveIndoorEnvironment(@RequestBody IndoorEnvironmentEntity indoorEnvironment);
}
