package com.fastbee.iot.cache;

/**
 * 缓存的iot的key 常量
 */
public class DeviceCacheConstants {

    /**
     * 设备告警推送 redis key；连续多次报警时，只触发一次
     */
    private static final String DEVICE_ALARM_PUSH_KEY = "device_alarm_push:";

    /**
     * 设备告警 redis key；只要触发告警就修改缓存
     */
    private static final String DEVICE_ALARM_KEY = "device_alarm:";

    /**
     * 设备信息 redis key
     */
    private static final String DEVICE_LOG_KEY = "device_log:";

    /**
     * 设备信息 redis key
     */
    private static final String DEVICE_INFO_KEY = "device_info:";

    /**
     * 插入数据库间隔
     */
    private static final String DEVICE_INSERT_DB = "device_insert:";


    public static String getDeviceAlarmPushKey(String deviceId, String triggerName, String operator, String value) {
        return DEVICE_ALARM_PUSH_KEY + deviceId + ":" + triggerName + ":" + operator + ":" + value;
    }

    public static String getDeviceAlarmKey(String deviceId) {
        return DEVICE_ALARM_KEY + deviceId;
    }

    public static String getDeviceLogKey(String deviceId) {
        return DEVICE_LOG_KEY + deviceId;
    }

    public static String getDeviceInfoKey(Long deviceId) {
        return DEVICE_INFO_KEY + deviceId;
    }

    public static String getDeviceInsertDb(Long deviceId) {
        return DEVICE_INSERT_DB + deviceId;
    }

}
