# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Actions

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

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

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

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

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

def SleepParamStart(builder): builder.StartObject(1)
def Start(builder):
    return SleepParamStart(builder)
def SleepParamAddMs(builder, ms): builder.PrependUint32Slot(0, ms, 0)
def AddMs(builder, ms):
    return SleepParamAddMs(builder, ms)
def SleepParamEnd(builder): return builder.EndObject()
def End(builder):
    return SleepParamEnd(builder)

class SleepParamT(object):

    # SleepParamT
    def __init__(self):
        self.ms = 0  # type: int

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

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

    # SleepParamT
    def _UnPack(self, sleepParam):
        if sleepParam is None:
            return
        self.ms = sleepParam.Ms()

    # SleepParamT
    def Pack(self, builder):
        SleepParamStart(builder)
        SleepParamAddMs(builder, self.ms)
        sleepParam = SleepParamEnd(builder)
        return sleepParam
