package com.tsi.comm.server.protocol.enums;

import lombok.Getter;

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

public enum eTimeReliability {

    FIXED_TIMING    (0, "FIXED_TIMING"),        //고정신호시간
    VARIABLE_TIMING (1, "VARIABLE_TIMING");     //가변신호시간

    @Getter
    private final int value;
    private final String string;

    private static final Map<Integer, eTimeReliability> map;
    static {
        map = new HashMap<>();
        for (eTimeReliability e : values()) {
            map.put(e.value, e);
        }
    }
    public static eTimeReliability getByValue(int value) {
        return map.get(value);
    }
    public static eTimeReliability getByValue(byte value) {
        int intValue = (int)(value & 0x0F);
        return getByValue(intValue);
    }

    eTimeReliability(int value, String string) {
        this.value  = value;
        this.string = string;
    }

    public String toString() {
        return this.string;
    }
}
