public enum BarcodeType {
    QR_CODE(1), CODE_128(2), EAN_13(3);

    private final int value;

    private BarcodeType(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    public static BarcodeType parse(int value){
        for (BarcodeType type : BarcodeType.values()) {
            if (value == type.getValue()) {
                return type;
            }
        }
        return EAN_13;
    }
}