# automatically generated by the FlatBuffers compiler, do not modify

# namespace: AllWatchSerialize

import flatbuffers

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

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

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

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

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

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

    # TemplateRoot
    def DataBindingsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def TemplateRootStart(builder): builder.StartObject(3)
def TemplateRootAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
def TemplateRootAddLayout(builder, layout): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(layout), 0)
def TemplateRootAddDataBindings(builder, dataBindings): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(dataBindings), 0)
def TemplateRootStartDataBindingsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def TemplateRootEnd(builder): return builder.EndObject()
