package com.beanit.asn1dsrc.enums;

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

public enum eControlCommand {

    ControlCommand_Status_Request       (0x00, "ControlCommand_Status_Request"),
    ControlCommand_Reset                (0x01, "ControlCommand_Reset"),
    ControlCommand_Push_Broadcast_Delete(0x02, "ControlCommand_Push_Broadcast_Delete"),
    ControlCommand_Broadcast_Delete     (0x03, "ControlCommand_Broadcast_Delete"),
    ControlCommand_Wireless_Stop        (0x04, "ControlCommand_Wireless_Stop"),
    ControlCommand_Wireless_Start       (0x05, "ControlCommand_Wireless_Start");

    private final int value;
    private final String string;

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

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

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