# automatically generated by the FlatBuffers compiler, do not modify

# namespace: proto

from autobahn import flatbuffers
from autobahn.flatbuffers.compat import import_numpy

np = import_numpy()


class Invocation(object):
    __slots__ = ["_tab"]

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

    @classmethod
    def GetRootAsInvocation(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)

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

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

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

    # Invocation
    def Registration(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(
                flatbuffers.number_types.Uint64Flags, o + self._tab.Pos
            )
        return 0

    # Positional values for application-defined call arguments.
    # Invocation
    def Args(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(
                flatbuffers.number_types.Uint8Flags,
                a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1),
            )
        return 0

    # Invocation
    def ArgsAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Invocation
    def ArgsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Invocation
    def ArgsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        return o == 0

    # Keyword values for application-defined call arguments.
    # Invocation
    def Kwargs(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(
                flatbuffers.number_types.Uint8Flags,
                a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1),
            )
        return 0

    # Invocation
    def KwargsAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Invocation
    def KwargsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Invocation
    def KwargsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        return o == 0

    # Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
    # Invocation
    def Payload(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(
                flatbuffers.number_types.Uint8Flags,
                a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1),
            )
        return 0

    # Invocation
    def PayloadAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Invocation
    def PayloadLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Invocation
    def PayloadIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        return o == 0

    # The specific scheme in use with Payload Passthru (PPT) mode for the application payload.
    # Invocation
    def PptScheme(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # The specific serializer encoding the application payload with the Payload Passthru (PPT) scheme in use.
    # Invocation
    def PptSerializer(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # The cryptographic algorithm ("cipher") encrypting the application payload with the Payload Passthru (PPT) scheme in use.
    # Invocation
    def PptCipher(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # The identifier or reference to the encryption key that was used to encrypt the payload with the Payload Passthru (PPT) scheme and cipher in use.
    # Invocation
    def PptKeyid(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Invocation
    def Procedure(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

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

    # Invocation
    def ReceiveProgress(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
        if o != 0:
            return bool(
                self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)
            )
        return False

    # Invocation
    def TransactionHash(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Invocation
    def Caller(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
        if o != 0:
            return self._tab.Get(
                flatbuffers.number_types.Uint64Flags, o + self._tab.Pos
            )
        return 0

    # Invocation
    def CallerAuthid(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Invocation
    def CallerAuthrole(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Invocation
    def ForwardFor(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from autobahn.wamp.gen.wamp.proto.Principal import Principal

            obj = Principal()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Invocation
    def ForwardForLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Invocation
    def ForwardForIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
        return o == 0


def InvocationStart(builder):
    builder.StartObject(18)


def Start(builder):
    InvocationStart(builder)


def InvocationAddSession(builder, session):
    builder.PrependUint64Slot(0, session, 0)


def AddSession(builder, session):
    InvocationAddSession(builder, session)


def InvocationAddRequest(builder, request):
    builder.PrependUint64Slot(1, request, 0)


def AddRequest(builder, request):
    InvocationAddRequest(builder, request)


def InvocationAddRegistration(builder, registration):
    builder.PrependUint64Slot(2, registration, 0)


def AddRegistration(builder, registration):
    InvocationAddRegistration(builder, registration)


def InvocationAddArgs(builder, args):
    builder.PrependUOffsetTRelativeSlot(
        3, flatbuffers.number_types.UOffsetTFlags.py_type(args), 0
    )


def AddArgs(builder, args):
    InvocationAddArgs(builder, args)


def InvocationStartArgsVector(builder, numElems):
    return builder.StartVector(1, numElems, 1)


def StartArgsVector(builder, numElems):
    return InvocationStartArgsVector(builder, numElems)


def InvocationAddKwargs(builder, kwargs):
    builder.PrependUOffsetTRelativeSlot(
        4, flatbuffers.number_types.UOffsetTFlags.py_type(kwargs), 0
    )


def AddKwargs(builder, kwargs):
    InvocationAddKwargs(builder, kwargs)


def InvocationStartKwargsVector(builder, numElems):
    return builder.StartVector(1, numElems, 1)


def StartKwargsVector(builder, numElems):
    return InvocationStartKwargsVector(builder, numElems)


def InvocationAddPayload(builder, payload):
    builder.PrependUOffsetTRelativeSlot(
        5, flatbuffers.number_types.UOffsetTFlags.py_type(payload), 0
    )


def AddPayload(builder, payload):
    InvocationAddPayload(builder, payload)


def InvocationStartPayloadVector(builder, numElems):
    return builder.StartVector(1, numElems, 1)


def StartPayloadVector(builder, numElems):
    return InvocationStartPayloadVector(builder, numElems)


def InvocationAddPptScheme(builder, pptScheme):
    builder.PrependUint8Slot(6, pptScheme, 0)


def AddPptScheme(builder, pptScheme):
    InvocationAddPptScheme(builder, pptScheme)


def InvocationAddPptSerializer(builder, pptSerializer):
    builder.PrependUint8Slot(7, pptSerializer, 0)


def AddPptSerializer(builder, pptSerializer):
    InvocationAddPptSerializer(builder, pptSerializer)


def InvocationAddPptCipher(builder, pptCipher):
    builder.PrependUint8Slot(8, pptCipher, 0)


def AddPptCipher(builder, pptCipher):
    InvocationAddPptCipher(builder, pptCipher)


def InvocationAddPptKeyid(builder, pptKeyid):
    builder.PrependUOffsetTRelativeSlot(
        9, flatbuffers.number_types.UOffsetTFlags.py_type(pptKeyid), 0
    )


def AddPptKeyid(builder, pptKeyid):
    InvocationAddPptKeyid(builder, pptKeyid)


def InvocationAddProcedure(builder, procedure):
    builder.PrependUOffsetTRelativeSlot(
        10, flatbuffers.number_types.UOffsetTFlags.py_type(procedure), 0
    )


def AddProcedure(builder, procedure):
    InvocationAddProcedure(builder, procedure)


def InvocationAddTimeout(builder, timeout):
    builder.PrependUint32Slot(11, timeout, 0)


def AddTimeout(builder, timeout):
    InvocationAddTimeout(builder, timeout)


def InvocationAddReceiveProgress(builder, receiveProgress):
    builder.PrependBoolSlot(12, receiveProgress, 0)


def AddReceiveProgress(builder, receiveProgress):
    InvocationAddReceiveProgress(builder, receiveProgress)


def InvocationAddTransactionHash(builder, transactionHash):
    builder.PrependUOffsetTRelativeSlot(
        13, flatbuffers.number_types.UOffsetTFlags.py_type(transactionHash), 0
    )


def AddTransactionHash(builder, transactionHash):
    InvocationAddTransactionHash(builder, transactionHash)


def InvocationAddCaller(builder, caller):
    builder.PrependUint64Slot(14, caller, 0)


def AddCaller(builder, caller):
    InvocationAddCaller(builder, caller)


def InvocationAddCallerAuthid(builder, callerAuthid):
    builder.PrependUOffsetTRelativeSlot(
        15, flatbuffers.number_types.UOffsetTFlags.py_type(callerAuthid), 0
    )


def AddCallerAuthid(builder, callerAuthid):
    InvocationAddCallerAuthid(builder, callerAuthid)


def InvocationAddCallerAuthrole(builder, callerAuthrole):
    builder.PrependUOffsetTRelativeSlot(
        16, flatbuffers.number_types.UOffsetTFlags.py_type(callerAuthrole), 0
    )


def AddCallerAuthrole(builder, callerAuthrole):
    InvocationAddCallerAuthrole(builder, callerAuthrole)


def InvocationAddForwardFor(builder, forwardFor):
    builder.PrependUOffsetTRelativeSlot(
        17, flatbuffers.number_types.UOffsetTFlags.py_type(forwardFor), 0
    )


def AddForwardFor(builder, forwardFor):
    InvocationAddForwardFor(builder, forwardFor)


def InvocationStartForwardForVector(builder, numElems):
    return builder.StartVector(4, numElems, 4)


def StartForwardForVector(builder, numElems):
    return InvocationStartForwardForVector(builder, numElems)


def InvocationEnd(builder):
    return builder.EndObject()


def End(builder):
    return InvocationEnd(builder)
