package com.its.vms.domain.enums;

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

public enum eTrafficGrade {

    grade_none       ( 0, "0.정보없음"),
    grade_smoothness ( 1, "1.원활"),
    grade_delay      ( 2, "2.지체"),
    grade_congestion ( 3, "3.정체");

    private final int value;
    private final String string;

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

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

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

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

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