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

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

public enum eVmsImageType {

    VMS_IMAGE_TYPE_BMP  (0x00, "0x00.image_bmp"),
    VMS_IMAGE_TYPE_GIF  (0x01, "0x01.image_gif"),
    VMS_IMAGE_TYPE_JPG  (0x02, "0x02.image_jpg"),
    VMS_IMAGE_TYPE_PNG  (0x03, "0x03.image_png"),
    VMS_IMAGE_TYPE_VIDEO(0x04, "0x04.image_avi");

    private final int value;
    private final String string;

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

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

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

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

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