# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Actions

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

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

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

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

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

    # AppQuitParam
    def DelayMs(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
        return 0

def AppQuitParamStart(builder): builder.StartObject(2)
def Start(builder):
    return AppQuitParamStart(builder)
def AppQuitParamAddExitCode(builder, exitCode): builder.PrependInt32Slot(0, exitCode, 0)
def AddExitCode(builder, exitCode):
    return AppQuitParamAddExitCode(builder, exitCode)
def AppQuitParamAddDelayMs(builder, delayMs): builder.PrependUint32Slot(1, delayMs, 0)
def AddDelayMs(builder, delayMs):
    return AppQuitParamAddDelayMs(builder, delayMs)
def AppQuitParamEnd(builder): return builder.EndObject()
def End(builder):
    return AppQuitParamEnd(builder)

class AppQuitParamT(object):

    # AppQuitParamT
    def __init__(self):
        self.exitCode = 0  # type: int
        self.delayMs = 0  # type: int

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

    @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, appQuitParam):
        x = AppQuitParamT()
        x._UnPack(appQuitParam)
        return x

    # AppQuitParamT
    def _UnPack(self, appQuitParam):
        if appQuitParam is None:
            return
        self.exitCode = appQuitParam.ExitCode()
        self.delayMs = appQuitParam.DelayMs()

    # AppQuitParamT
    def Pack(self, builder):
        AppQuitParamStart(builder)
        AppQuitParamAddExitCode(builder, self.exitCode)
        AppQuitParamAddDelayMs(builder, self.delayMs)
        appQuitParam = AppQuitParamEnd(builder)
        return appQuitParam
