# automatically generated by the FlatBuffers compiler, do not modify

# namespace: fbs

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

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

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

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

    # Message
    def Observation(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from nle.fbs.Observation import Observation
            obj = Observation()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Message
    def Blstats(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = o + self._tab.Pos
            from nle.fbs.Blstats import Blstats
            obj = Blstats()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Message
    def You(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = o + self._tab.Pos
            from nle.fbs.You import You
            obj = You()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Message
    def Windows(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        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.Window import Window
            obj = Window()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Message
    def WindowsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Message
    def WindowsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        return o == 0

    # Message
    def Internal(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from nle.fbs.Internal import Internal
            obj = Internal()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Message
    def ProgramState(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            x = o + self._tab.Pos
            from nle.fbs.ProgramState import ProgramState
            obj = ProgramState()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Message
    def Seeds(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            x = o + self._tab.Pos
            from nle.fbs.Seeds import Seeds
            obj = Seeds()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Message
    def NotRunning(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

def MessageStart(builder): builder.StartObject(8)
def MessageAddObservation(builder, observation): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(observation), 0)
def MessageAddBlstats(builder, blstats): builder.PrependStructSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(blstats), 0)
def MessageAddYou(builder, you): builder.PrependStructSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(you), 0)
def MessageAddWindows(builder, windows): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(windows), 0)
def MessageStartWindowsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def MessageAddInternal(builder, internal): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(internal), 0)
def MessageAddProgramState(builder, programState): builder.PrependStructSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(programState), 0)
def MessageAddSeeds(builder, seeds): builder.PrependStructSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(seeds), 0)
def MessageAddNotRunning(builder, notRunning): builder.PrependBoolSlot(7, notRunning, 0)
def MessageEnd(builder): return builder.EndObject()
