package com.tsi.app.common.cpu.enums;

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

public enum eAckNak {

    TSI_CPU_ACK (0x06, "TSI_CPU_ACK"),  //ack
    TSI_CPU_NAK (0x15, "TSI_CPU_NAK");  //nack

    private final int value;
    private final String string;

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

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

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