package com.yuchen.saas.device.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.nest.springwrap.core.log.exception.ServiceException;

@Getter
@AllArgsConstructor
public enum NetDataTypeEnum {

    INT(1, "int(整数型)","int"),
    LONG(2, "long(长整数型)","long"),
    FLOAT(3, "float(单精度浮点型)","float"),
    DOUBLE(4, "double(双精度浮点型)","double"),
    TEXT(5, "text(字符串)","text"),
    BOOL(6, "bool(布尔型)","bool"),
    TIME(7, "time(时间类型)","time"),

    ;

    private Integer value;
    private String desc;
    private String propMode;

    public static NetDataTypeEnum convert(int intValue) {
        NetDataTypeEnum[] allValues = NetDataTypeEnum.values();
        for (NetDataTypeEnum allValue : allValues) {
            if (allValue.value == intValue) {
                return allValue;
            }
        }
        throw new ServiceException("NetDataTypeEnum 非法枚举参数值");
    }


}
