# automatically generated by the FlatBuffers compiler, do not modify

# namespace: AllWatchSerialize

import flatbuffers

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

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

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

    # MessagingData
    def Messages(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .Message import Message
            obj = Message()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # MessagingData
    def MessagesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # MessagingData
    def Profiles(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 .Profile import Profile
            obj = Profile()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

def MessagingDataStart(builder): builder.StartObject(2)
def MessagingDataAddMessages(builder, messages): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(messages), 0)
def MessagingDataStartMessagesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def MessagingDataAddProfiles(builder, profiles): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(profiles), 0)
def MessagingDataStartProfilesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def MessagingDataEnd(builder): return builder.EndObject()
