# automatically generated by the FlatBuffers compiler, do not modify

# namespace: API

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

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

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

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

    # Timespan
    def Label(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

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

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

def TimespanStart(builder): builder.StartObject(3)
def TimespanAddLabel(builder, label): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(label), 0)
def TimespanAddPastOffset(builder, pastOffset): builder.PrependUint64Slot(1, pastOffset, 0)
def TimespanAddFutureOffset(builder, futureOffset): builder.PrependUint64Slot(2, futureOffset, 0)
def TimespanEnd(builder): return builder.EndObject()
