package com.beanit.asn1dsrc.enums;

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

public enum eTerminate {

    Terminate_Other                 (0x00, "Terminate_Other"),
    Terminate_ServerRequested       (0x01, "Terminate_ServerRequested"),
    Terminate_ClientRequested       (0x02, "Terminate_ClientRequested"),
    Terminate_ServerShutdown        (0x03, "Terminate_ServerShutdown"),
    Terminate_ClientShutdown        (0x03, "Terminate_ClientShutdown"),
    Terminate_ServerCommProblems    (0x03, "Terminate_ServerCommProblems"),
    Terminate_ClientCommProblesm    (0x04, "Terminate_ClientCommProblesm");

    private final int value;
    private final String string;

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

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

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