package com.beanit.asn1dsrc.enums;

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

public enum ePdusPr {

    PDUs_PR_NOTHING            (0x00, "PDUs_PR_NOTHING"),	            /* No components present */
    PDUs_PR_datex_Initiate_null(0x01, "PDUs_PR_datex_Initiate_null"),
    PDUs_PR_login              (0x02, "PDUs_PR_login"),
    PDUs_PR_fred               (0x03, "PDUs_PR_fred"),
    PDUs_PR_terminate          (0x04, "PDUs_PR_terminate"),
    PDUs_PR_logout             (0x05, "PDUs_PR_logout"),
    PDUs_PR_subscripiton       (0x06, "PDUs_PR_subscripiton"),
    PDUs_PR_publication        (0x07, "PDUs_PR_publication"),
    PDUs_PR_transfer_done      (0x08, "PDUs_PR_transfer_done"),
    PDUs_PR_accept             (0x09, "PDUs_PR_accept"),
    PDUs_PR_reject             (0x0A, "PDUs_PR_reject");

    private final int value;
    private final String string;

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

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

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