# automatically generated by the FlatBuffers compiler, do not modify

# namespace: API

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

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

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

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

    # SearchGranules
    def Current(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

    # SearchGranules
    def Start(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

    # SearchGranules
    def Stop(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

    # SearchGranules
    def Zoom(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # SearchGranules
    def Collections(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 8
            from SEAScope.API.CollectionId import CollectionId
            obj = CollectionId()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SearchGranules
    def CollectionsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SearchGranules
    def CollectionsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        return o == 0

def SearchGranulesStart(builder): builder.StartObject(5)
def SearchGranulesAddCurrent(builder, current): builder.PrependUint64Slot(0, current, 0)
def SearchGranulesAddStart(builder, start): builder.PrependUint64Slot(1, start, 0)
def SearchGranulesAddStop(builder, stop): builder.PrependUint64Slot(2, stop, 0)
def SearchGranulesAddZoom(builder, zoom): builder.PrependFloat32Slot(3, zoom, 0.0)
def SearchGranulesAddCollections(builder, collections): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(collections), 0)
def SearchGranulesStartCollectionsVector(builder, numElems): return builder.StartVector(8, numElems, 4)
def SearchGranulesEnd(builder): return builder.EndObject()
