package cgmblelib.Enum;

/**
 * Created by minyuchun on 2019/1/25.
 * enum show error of glucose
 * 血糖上显示的错误标记
 * @author minyuchun
 */

public enum enumError {
    /**
     * 血糖点错误 无
     */
    NONE(0,
            enumSound.NONE
    ),
    /**
     * 计算时数据错误
     */
    ERROR_DATA(1,
            enumSound.NONE
    ),

    /**
     * 电流异常 过小
     */
    ERROR_CURRENT_SMALL(103,
            enumSound.MEDIUM
    ),

    /**
     * 周期结束
     */
    INFO_COMPLETE_END(5, enumSound.NONE),

    /***
     * 电流波动
     */
    ERROR_NOISE(11,
            enumSound.MEDIUM),
    /**
     * 衰减
     */
    ERROR_SENSITIVITY_ATTENUATION(12,
            enumSound.MEDIUM),
    /**
     * 脱出
     */
    ERROR_TAKE_OFF(13,
            enumSound.MEDIUM),
    /**
     * 外膜破损
     */
    ERROR_BREAKAGE(14,
            enumSound.MEDIUM),
    /**
     * 接触问题
     */
    ERROR_TOUCH(15,
            enumSound.MEDIUM),
    /**
     * 进水问题
     */
    ERROR_FLOODING_WATER(16,
            enumSound.MEDIUM);


    /**异常的id*/
    private int errorId;
    /**异常的声音*/
    private enumSound sound;

    enumError(int errorId, enumSound sound){
        this.errorId = errorId;
        this.sound = sound;
    }

    public int getErrorId() {
        return errorId;
    }

    public enumSound getSound() {
        return sound;
    }

    public static enumError getEnumError(int id){
        for (enumError e : enumError.values()) {
            if (id == e.getErrorId()) {
                return e;
            }
        }
        return NONE;
    }

    @Override
    public String toString() {
        return "enumError{" +
                "errorId=" + errorId +
                ", sound=" + sound +
                '}';
    }
}
