# automatically generated by the FlatBuffers compiler, do not modify

# namespace:

import flatbuffers


class Stream(object):
    __slots__ = ["_tab"]

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

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

    # Stream
    def Channel(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

    # Stream
    def Schema(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

    # Stream
    def Topic(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

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


def StreamStart(builder):
    builder.StartObject(4)


def StreamAddChannel(builder, channel):
    builder.PrependUOffsetTRelativeSlot(
        0, flatbuffers.number_types.UOffsetTFlags.py_type(channel), 0
    )


def StreamAddSchema(builder, schema):
    builder.PrependUOffsetTRelativeSlot(
        1, flatbuffers.number_types.UOffsetTFlags.py_type(schema), 0
    )


def StreamAddTopic(builder, topic):
    builder.PrependUOffsetTRelativeSlot(
        2, flatbuffers.number_types.UOffsetTFlags.py_type(topic), 0
    )


def StreamAddProtocol(builder, protocol):
    builder.PrependUint16Slot(3, protocol, 0)


def StreamEnd(builder):
    return builder.EndObject()
