# automatically generated by the FlatBuffers compiler, do not modify

# namespace: shortcuts_uint16

import flatbuffers
from flatbuffers.compat import import_numpy

np = import_numpy()


class HybridShortcutEntry:
    __slots__ = ["_tab"]

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = HybridShortcutEntry()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsHybridShortcutEntry(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)

    # HybridShortcutEntry
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # HybridShortcutEntry
    def HexId(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(
                flatbuffers.number_types.Uint64Flags, o + self._tab.Pos
            )
        return 0

    # HybridShortcutEntry
    def ValueType(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # HybridShortcutEntry
    def Value(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            from flatbuffers.table import Table

            obj = Table(bytearray(), 0)
            self._tab.Union(obj, o)
            return obj
        return None


def HybridShortcutEntryStart(builder):
    builder.StartObject(3)


def Start(builder):
    HybridShortcutEntryStart(builder)


def HybridShortcutEntryAddHexId(builder, hexId):
    builder.PrependUint64Slot(0, hexId, 0)


def AddHexId(builder, hexId):
    HybridShortcutEntryAddHexId(builder, hexId)


def HybridShortcutEntryAddValueType(builder, valueType):
    builder.PrependUint8Slot(1, valueType, 0)


def AddValueType(builder, valueType):
    HybridShortcutEntryAddValueType(builder, valueType)


def HybridShortcutEntryAddValue(builder, value):
    builder.PrependUOffsetTRelativeSlot(
        2, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0
    )


def AddValue(builder, value):
    HybridShortcutEntryAddValue(builder, value)


def HybridShortcutEntryEnd(builder):
    return builder.EndObject()


def End(builder):
    return HybridShortcutEntryEnd(builder)
