# automatically generated by the FlatBuffers compiler, do not modify

# namespace: AllWatchSerialize

import flatbuffers

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

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

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

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

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

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

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

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

    # Template
    def Id(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return bytes()

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

    # Template
    def ChildrenLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def TemplateStart(builder): builder.StartObject(7)
def TemplateAddType(builder, type): builder.PrependInt16Slot(0, type, 0)
def TemplateAddStyle(builder, style): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0)
def TemplateAddAction(builder, action): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(action), 0)
def TemplateAddAttributesType(builder, attributesType): builder.PrependUint8Slot(3, attributesType, 0)
def TemplateAddAttributes(builder, attributes): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
def TemplateAddId(builder, id): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0)
def TemplateAddChildren(builder, children): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(children), 0)
def TemplateStartChildrenVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def TemplateEnd(builder): return builder.EndObject()
