# 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 Result(object):
    __slots__ = ["_tab"]

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

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

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

    # Result
    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

    # Result
    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

    # Positional values for application-defined call result.
    # Result
    def Args(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        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

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

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

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

    # Keyword values for application-defined call result.
    # Result
    def Kwargs(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

    # Result
    def KwargsAsNumpy(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

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

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

    # Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
    # Result
    def Payload(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

    # Result
    def PayloadAsNumpy(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

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

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

    # The specific scheme in use with Payload Passthru (PPT) mode for the application payload.
    # Result
    def PptScheme(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        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.
    # Result
    def PptSerializer(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 cryptographic algorithm ("cipher") encrypting the application payload with the Payload Passthru (PPT) scheme in use.
    # Result
    def PptCipher(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 identifier or reference to the encryption key that was used to encrypt the payload with the Payload Passthru (PPT) scheme and cipher in use.
    # Result
    def PptKeyid(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

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

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

    # Result
    def CalleeAuthid(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Result
    def CalleeAuthrole(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Result
    def ForwardFor(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
        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

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

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


def ResultStart(builder):
    builder.StartObject(14)


def Start(builder):
    ResultStart(builder)


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


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


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


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


def ResultAddArgs(builder, args):
    builder.PrependUOffsetTRelativeSlot(
        2, flatbuffers.number_types.UOffsetTFlags.py_type(args), 0
    )


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


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


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


def ResultAddKwargs(builder, kwargs):
    builder.PrependUOffsetTRelativeSlot(
        3, flatbuffers.number_types.UOffsetTFlags.py_type(kwargs), 0
    )


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


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


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


def ResultAddPayload(builder, payload):
    builder.PrependUOffsetTRelativeSlot(
        4, flatbuffers.number_types.UOffsetTFlags.py_type(payload), 0
    )


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


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


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


def ResultAddPptScheme(builder, pptScheme):
    builder.PrependUint8Slot(5, pptScheme, 0)


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


def ResultAddPptSerializer(builder, pptSerializer):
    builder.PrependUint8Slot(6, pptSerializer, 0)


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


def ResultAddPptCipher(builder, pptCipher):
    builder.PrependUint8Slot(7, pptCipher, 0)


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


def ResultAddPptKeyid(builder, pptKeyid):
    builder.PrependUOffsetTRelativeSlot(
        8, flatbuffers.number_types.UOffsetTFlags.py_type(pptKeyid), 0
    )


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


def ResultAddProgress(builder, progress):
    builder.PrependBoolSlot(9, progress, 0)


def AddProgress(builder, progress):
    ResultAddProgress(builder, progress)


def ResultAddCallee(builder, callee):
    builder.PrependUint64Slot(10, callee, 0)


def AddCallee(builder, callee):
    ResultAddCallee(builder, callee)


def ResultAddCalleeAuthid(builder, calleeAuthid):
    builder.PrependUOffsetTRelativeSlot(
        11, flatbuffers.number_types.UOffsetTFlags.py_type(calleeAuthid), 0
    )


def AddCalleeAuthid(builder, calleeAuthid):
    ResultAddCalleeAuthid(builder, calleeAuthid)


def ResultAddCalleeAuthrole(builder, calleeAuthrole):
    builder.PrependUOffsetTRelativeSlot(
        12, flatbuffers.number_types.UOffsetTFlags.py_type(calleeAuthrole), 0
    )


def AddCalleeAuthrole(builder, calleeAuthrole):
    ResultAddCalleeAuthrole(builder, calleeAuthrole)


def ResultAddForwardFor(builder, forwardFor):
    builder.PrependUOffsetTRelativeSlot(
        13, flatbuffers.number_types.UOffsetTFlags.py_type(forwardFor), 0
    )


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


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


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


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


def End(builder):
    return ResultEnd(builder)
