# automatically generated by the FlatBuffers compiler, do not modify

# namespace: papi

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

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

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

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

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

    # MDSnapshotL2
    def Source(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # MDSnapshotL2
    def Market(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # MDSnapshotL2
    def FeedId(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # MDSnapshotL2
    def Id(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
        return 0

    # MDSnapshotL2
    def Depth(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 0

    # MDSnapshotL2
    def Flags(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
        return 0

    # MDSnapshotL2
    def BidSide(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 16
            from reactive.papi.MDLevel2 import MDLevel2
            obj = MDLevel2()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # MDSnapshotL2
    def BidSideLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # MDSnapshotL2
    def BidSideIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        return o == 0

    # MDSnapshotL2
    def OfferSide(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 16
            from reactive.papi.MDLevel2 import MDLevel2
            obj = MDLevel2()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # MDSnapshotL2
    def OfferSideLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # MDSnapshotL2
    def OfferSideIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        return o == 0

def MDSnapshotL2Start(builder): builder.StartObject(9)
def MDSnapshotL2AddSourceTs(builder, sourceTs): builder.PrependInt64Slot(0, sourceTs, 0)
def MDSnapshotL2AddSource(builder, source): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(source), 0)
def MDSnapshotL2AddMarket(builder, market): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(market), 0)
def MDSnapshotL2AddFeedId(builder, feedId): builder.PrependInt32Slot(3, feedId, 0)
def MDSnapshotL2AddId(builder, id): builder.PrependInt64Slot(4, id, 0)
def MDSnapshotL2AddDepth(builder, depth): builder.PrependInt16Slot(5, depth, 0)
def MDSnapshotL2AddFlags(builder, flags): builder.PrependUint16Slot(6, flags, 0)
def MDSnapshotL2AddBidSide(builder, bidSide): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(bidSide), 0)
def MDSnapshotL2StartBidSideVector(builder, numElems): return builder.StartVector(16, numElems, 8)
def MDSnapshotL2AddOfferSide(builder, offerSide): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(offerSide), 0)
def MDSnapshotL2StartOfferSideVector(builder, numElems): return builder.StartVector(16, numElems, 8)
def MDSnapshotL2End(builder): return builder.EndObject()
