# automatically generated by the FlatBuffers compiler, do not modify

# namespace: AllWatchSerialize

import flatbuffers

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

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

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

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

    # Command
    def Command(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            from flatbuffers.table import Table
            obj = Table(bytearray(), 0)
            self._tab.Union(obj, o)
            return obj
        return None

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

def CommandStart(builder): builder.StartObject(3)
def CommandAddCommandType(builder, commandType): builder.PrependUint8Slot(0, commandType, 0)
def CommandAddCommand(builder, command): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(command), 0)
def CommandAddId(builder, id): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0)
def CommandEnd(builder): return builder.EndObject()
