# automatically generated by the FlatBuffers compiler, do not modify

# namespace: generated

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

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

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

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

    # Request
    def Seq(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

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

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

def RequestStart(builder): builder.StartObject(3)
def Start(builder):
    return RequestStart(builder)
def RequestAddSeq(builder, seq): builder.PrependUint32Slot(0, seq, 0)
def AddSeq(builder, seq):
    return RequestAddSeq(builder, seq)
def RequestAddParamType(builder, paramType): builder.PrependUint8Slot(1, paramType, 0)
def AddParamType(builder, paramType):
    return RequestAddParamType(builder, paramType)
def RequestAddParam(builder, param): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(param), 0)
def AddParam(builder, param):
    return RequestAddParam(builder, param)
def RequestEnd(builder): return builder.EndObject()
def End(builder):
    return RequestEnd(builder)
import gamium.protocol.generated.Packets.ActionsParam
import gamium.protocol.generated.Packets.ChangeConfigurationParam
import gamium.protocol.generated.Packets.DumpObjectsHierarchyParam
import gamium.protocol.generated.Packets.ExecuteRpcParam
import gamium.protocol.generated.Packets.FindObjectsParam
import gamium.protocol.generated.Packets.HelloParam
import gamium.protocol.generated.Packets.InspectObjectOnScreenParam
import gamium.protocol.generated.Packets.InspectObjectWithIdParam
import gamium.protocol.generated.Packets.QueryObjectInteractableParam
import gamium.protocol.generated.Packets.QueryProfileParam
import gamium.protocol.generated.Packets.QueryScreenParam
import gamium.protocol.generated.Param
try:
    from typing import Union
except:
    pass

class RequestT(object):

    # RequestT
    def __init__(self):
        self.seq = 0  # type: int
        self.paramType = 0  # type: int
        self.param = None  # type: Union[None, gamium.protocol.generated.Packets.HelloParam.HelloParamT, gamium.protocol.generated.Packets.QueryScreenParam.QueryScreenParamT, gamium.protocol.generated.Packets.FindObjectsParam.FindObjectsParamT, gamium.protocol.generated.Packets.QueryObjectInteractableParam.QueryObjectInteractableParamT, gamium.protocol.generated.Packets.ActionsParam.ActionsParamT, gamium.protocol.generated.Packets.ExecuteRpcParam.ExecuteRpcParamT, gamium.protocol.generated.Packets.InspectObjectOnScreenParam.InspectObjectOnScreenParamT, gamium.protocol.generated.Packets.InspectObjectWithIdParam.InspectObjectWithIdParamT, gamium.protocol.generated.Packets.DumpObjectsHierarchyParam.DumpObjectsHierarchyParamT, gamium.protocol.generated.Packets.ChangeConfigurationParam.ChangeConfigurationParamT, gamium.protocol.generated.Packets.QueryProfileParam.QueryProfileParamT]

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

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

    # RequestT
    def _UnPack(self, request):
        if request is None:
            return
        self.seq = request.Seq()
        self.paramType = request.ParamType()
        self.param = gamium.protocol.generated.Param.ParamCreator(self.paramType, request.Param())

    # RequestT
    def Pack(self, builder):
        if self.param is not None:
            param = self.param.Pack(builder)
        RequestStart(builder)
        RequestAddSeq(builder, self.seq)
        RequestAddParamType(builder, self.paramType)
        if self.param is not None:
            RequestAddParam(builder, param)
        request = RequestEnd(builder)
        return request
