# automatically generated by the FlatBuffers compiler, do not modify

# namespace: AllWatchSerialize

import flatbuffers

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

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

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

    # View
    def Id(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        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

    # View
    def Name(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return bytes()

    # View
    def Datatype(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 0

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

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

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

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

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

    # View
    def ActionsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # View
    def DefaultStyle(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 0

def ViewStart(builder): builder.StartObject(9)
def ViewAddId(builder, id): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0)
def ViewAddName(builder, name): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
def ViewAddDatatype(builder, datatype): builder.PrependInt16Slot(2, datatype, 0)
def ViewAddUsesTemplate(builder, usesTemplate): builder.PrependBoolSlot(3, usesTemplate, 0)
def ViewAddTemplate(builder, template): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(template), 0)
def ViewAddDataType(builder, dataType): builder.PrependUint8Slot(5, dataType, 0)
def ViewAddData(builder, data): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0)
def ViewAddActions(builder, actions): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(actions), 0)
def ViewStartActionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def ViewAddDefaultStyle(builder, defaultStyle): builder.PrependInt16Slot(8, defaultStyle, 0)
def ViewEnd(builder): return builder.EndObject()
