# automatically generated by the FlatBuffers compiler, do not modify

# namespace: fbs

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class Window(object):
    __slots__ = ['_tab']

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

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

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

    # Window
    def MenuItems(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from nle.fbs.MenuItem import MenuItem
            obj = MenuItem()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Window
    def MenuItemsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Window
    def MenuItemsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        return o == 0

    # Window
    def Strings(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

    # Window
    def StringsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Window
    def StringsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        return o == 0

def WindowStart(builder): builder.StartObject(3)
def WindowAddType(builder, type): builder.PrependInt8Slot(0, type, 0)
def WindowAddMenuItems(builder, menuItems): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(menuItems), 0)
def WindowStartMenuItemsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def WindowAddStrings(builder, strings): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(strings), 0)
def WindowStartStringsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def WindowEnd(builder): return builder.EndObject()
