# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Packets

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

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

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

    @classmethod
    def GetRootAsActionsParam(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # ActionsParam
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # ActionsParam
    def Actions(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

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

    # ActionsParam
    def ActionsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

def ActionsParamStart(builder): builder.StartObject(1)
def Start(builder):
    return ActionsParamStart(builder)
def ActionsParamAddActions(builder, actions): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(actions), 0)
def AddActions(builder, actions):
    return ActionsParamAddActions(builder, actions)
def ActionsParamStartActionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartActionsVector(builder, numElems):
    return ActionsParamStartActionsVector(builder, numElems)
def ActionsParamEnd(builder): return builder.EndObject()
def End(builder):
    return ActionsParamEnd(builder)
try:
    from typing import List
except:
    pass

class ActionsParamT(object):

    # ActionsParamT
    def __init__(self):
        self.actions = None  # type: List[str]

    @classmethod
    def InitFromBuf(cls, buf, pos):
        actionsParam = ActionsParam()
        actionsParam.Init(buf, pos)
        return cls.InitFromObj(actionsParam)

    @classmethod
    def InitFromPackedBuf(cls, buf, pos=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
        return cls.InitFromBuf(buf, pos+n)

    @classmethod
    def InitFromObj(cls, actionsParam):
        x = ActionsParamT()
        x._UnPack(actionsParam)
        return x

    # ActionsParamT
    def _UnPack(self, actionsParam):
        if actionsParam is None:
            return
        if not actionsParam.ActionsIsNone():
            self.actions = []
            for i in range(actionsParam.ActionsLength()):
                self.actions.append(actionsParam.Actions(i))

    # ActionsParamT
    def Pack(self, builder):
        if self.actions is not None:
            actionslist = []
            for i in range(len(self.actions)):
                actionslist.append(builder.CreateString(self.actions[i]))
            ActionsParamStartActionsVector(builder, len(self.actions))
            for i in reversed(range(len(self.actions))):
                builder.PrependUOffsetTRelative(actionslist[i])
            actions = builder.EndVector()
        ActionsParamStart(builder)
        if self.actions is not None:
            ActionsParamAddActions(builder, actions)
        actionsParam = ActionsParamEnd(builder)
        return actionsParam
