# automatically generated by the FlatBuffers compiler, do not modify

# namespace: tecrpc

import flatbuffers

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 Header(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Header import Header
            obj = Header()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

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

def MessageStart(builder): builder.StartObject(3)
def MessageAddHeader(builder, header): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(header), 0)
def MessageAddRequest(builder, request): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(request), 0)
def MessageAddReply(builder, reply): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(reply), 0)
def MessageEnd(builder): return builder.EndObject()
