package com.its.vms.xnettcp.vms.protocol.enums;

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

public enum eVmsProtocolVersion {

    PROTOCOL_EX_FIGURE ( 0, "0.ExpressHighway Figure"),
    PROTOCOL_EX_TEXT   ( 1, "0.ExpressHighway Text"),
    PROTOCOL_ANDONG    ( 2, "0.ANDONG");

    private final int value;
    private final String string;

    private static final Map<Integer, eVmsProtocolVersion> map;
    static {
        map = new HashMap<>();
        for (eVmsProtocolVersion e : values()) {
            map.put(e.value, e);
        }
    }

    public static eVmsProtocolVersion getValue(int value) {
        return map.get(value);
    }
    public static eVmsProtocolVersion getValue(byte value) {
        int intValue = (value & 0x0F);
        return map.get(intValue);
    }

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

    public int getValue() {
        return this.value;
    }

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