package com.ruoyi.common.core.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: TdEngine服务常量
 * @ClassName: TdEngineConstants
 * @Author  : xins
 * @Date    :2023-09-05  9:47
 * @Version :1.0
 */
public class TdEngineConstants {

    public static final String DEFAULT_FIRST_FIELD_NAME = "ts";//timestamp格式首字段，必须

    public static final String DEFAULT_ORDER_BY_MODE = "desc";//默认排序方式，逆序

    public static final String PAYLOAD_TS = "timestamp";//协议上传ts的key

    public static final String PAYLOAD_PARAM = "param";//协议上传的param key

    public static final String PAYLOAD_DATAVALUE = "datavalue";//协议上传数据的key

    public static final String PAYLOAD_DEVICE_CODE = "uid";//协议上传设备编号的key

    public static final String DEFAULT_DB_NAME_PREFIX = "db_scene_";//数据库名称前缀

    public static final String DEFAULT_SUPER_TABLE_NAME_PREFIX = "st_devicemode_";//超级表名称前缀
    public static final String DEFAULT_TABLE_NAME_PREFIX = "t_device_";//数据表名称前缀

    public static final String DEFAULT_DEVICE_STATUS_SUPER_TABLE_NAME= "st_ds";//设备状态超级表名称
    public static final String DEFAULT_DEVICE_STATUS_TABLE_NAME_PREFIX = "t_ds_";//设备状态数据表名称前缀

    public static final String PLATFORM_DB_NAME = "db_hwsaas";//全局数据库名称

    public static final String ST_TAG_DEVICECODE = "devicecode";
    public static final int ST_TAG_DEVICECODE_TYPE = 10;
    public static final int ST_TAG_DEVICECODE_SIZE=50;

    public static final String ST_TAG_DEVICENAME = "devicename";
    public static final int ST_TAG_DEVICENAME_TYPE = 10;
    public static final int ST_TAG_DEVICENAME_SIZE=200;

    public static final String ST_TAG_DEVICEID = "deviceid";
    public static final int ST_TAG_DEVICEID_TYPE = 2;

    public static final String ST_TAG_DEVICEMODEID = "devicemodeid";
    public static final int ST_TAG_DEVICEMODEID_TYPE = 2;

    public static final String ST_TAG_MONITORUNITID = "monitorunitid";
    public static final int ST_TAG_MONITORUNITID_TYPE = 2;

    /**
     * 需要转换的key
     */
    public static final Map<String, String> TDENGINE_KEY_TRANSFER_MAP = new HashMap<String, String>();

    static {
        TDENGINE_KEY_TRANSFER_MAP.put("value", "value1");
    }

    /**
     * @return String
     * @param: sceneId
     * @description 获取数据库名称
     * @author xins
     * @date 2023-09-05 9:42
     */
    public static String getDatabaseName(Long sceneId) {
        return DEFAULT_DB_NAME_PREFIX + sceneId;
    }

    /**
     * @param: deviceId
     * @return String
     * @description 获取设备数据子表名称
     * @author xins
     * @date 2023-09-05 9:42
     */
    public static String getDeviceDataTableName(Long deviceId) {
        return DEFAULT_TABLE_NAME_PREFIX + deviceId;
    }


}
