# automatically generated by the FlatBuffers compiler, do not modify

# namespace: xbr

import flatbuffers
from flatbuffers.compat import import_numpy

np = import_numpy()


# XBR data consent set by market actors.
class Consent(object):
    __slots__ = ["_tab"]

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

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

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

    # The ID of the catalog consent was set within [primary key].
    # Consent
    def MarketOid(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        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

    # Consent
    def MarketOidAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Consent
    def MarketOidLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Consent
    def MarketOidIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

    # Member (must be actor in market) that has set consent [primary key].
    # Consent
    def Member(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        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

    # Consent
    def MemberAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Consent
    def MemberLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Consent
    def MemberIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        return o == 0

    # Delegate for which consent is set [primary key].
    # Consent
    def Delegate(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

    # Consent
    def DelegateAsNumpy(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

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

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

    # Type of delegate for which consent was granted [primary key].
    # Consent
    def DelegateType(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # The ID of the catalog this consent was set for [primary key].
    # Consent
    def CatalogOid(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

    # Consent
    def CatalogOidAsNumpy(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

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

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

    # Database transaction time (epoch time in ns).
    # Consent
    def Timestamp(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # Block number when the consent was updated.
    # Consent
    def Updated(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        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

    # Consent
    def UpdatedAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Consent
    def UpdatedLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Consent
    def UpdatedIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        return o == 0

    # Consent granted or revoked.
    # Consent
    def Consent(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

    # The WAMP URI prefix to be used by the delegate when providing data service under an API of the catalog and in the data plane realm.
    # Consent
    def ServicePrefix(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

    # Transaction hash of the transaction this change was committed to the blockchain under.
    # Consent
    def Tid(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        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

    # Consent
    def TidAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Consent
    def TidLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Consent
    def TidIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        return o == 0

    # This is the signature the user (actor) supplied when setting the consent status.
    # Consent
    def Signature(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        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

    # Consent
    def SignatureAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Consent
    def SignatureLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Consent
    def SignatureIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        return o == 0

    # Whether the consent was set in blockchain
    # Consent
    def Synced(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False


def ConsentStart(builder):
    builder.StartObject(12)


def Start(builder):
    ConsentStart(builder)


def ConsentAddMarketOid(builder, marketOid):
    builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(marketOid), 0)


def AddMarketOid(builder, marketOid):
    ConsentAddMarketOid(builder, marketOid)


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


def StartMarketOidVector(builder, numElems: int) -> int:
    return ConsentStartMarketOidVector(builder, numElems)


def ConsentAddMember(builder, member):
    builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(member), 0)


def AddMember(builder, member):
    ConsentAddMember(builder, member)


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


def StartMemberVector(builder, numElems: int) -> int:
    return ConsentStartMemberVector(builder, numElems)


def ConsentAddDelegate(builder, delegate):
    builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(delegate), 0)


def AddDelegate(builder, delegate):
    ConsentAddDelegate(builder, delegate)


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


def StartDelegateVector(builder, numElems: int) -> int:
    return ConsentStartDelegateVector(builder, numElems)


def ConsentAddDelegateType(builder, delegateType):
    builder.PrependUint8Slot(3, delegateType, 0)


def AddDelegateType(builder, delegateType):
    ConsentAddDelegateType(builder, delegateType)


def ConsentAddCatalogOid(builder, catalogOid):
    builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(catalogOid), 0)


def AddCatalogOid(builder, catalogOid):
    ConsentAddCatalogOid(builder, catalogOid)


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


def StartCatalogOidVector(builder, numElems: int) -> int:
    return ConsentStartCatalogOidVector(builder, numElems)


def ConsentAddTimestamp(builder, timestamp):
    builder.PrependUint64Slot(5, timestamp, 0)


def AddTimestamp(builder, timestamp):
    ConsentAddTimestamp(builder, timestamp)


def ConsentAddUpdated(builder, updated):
    builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(updated), 0)


def AddUpdated(builder, updated):
    ConsentAddUpdated(builder, updated)


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


def StartUpdatedVector(builder, numElems: int) -> int:
    return ConsentStartUpdatedVector(builder, numElems)


def ConsentAddConsent(builder, consent):
    builder.PrependBoolSlot(7, consent, 0)


def AddConsent(builder, consent):
    ConsentAddConsent(builder, consent)


def ConsentAddServicePrefix(builder, servicePrefix):
    builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(servicePrefix), 0)


def AddServicePrefix(builder, servicePrefix):
    ConsentAddServicePrefix(builder, servicePrefix)


def ConsentAddTid(builder, tid):
    builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(tid), 0)


def AddTid(builder, tid):
    ConsentAddTid(builder, tid)


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


def StartTidVector(builder, numElems: int) -> int:
    return ConsentStartTidVector(builder, numElems)


def ConsentAddSignature(builder, signature):
    builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(signature), 0)


def AddSignature(builder, signature):
    ConsentAddSignature(builder, signature)


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


def StartSignatureVector(builder, numElems: int) -> int:
    return ConsentStartSignatureVector(builder, numElems)


def ConsentAddSynced(builder, synced):
    builder.PrependBoolSlot(11, synced, 0)


def AddSynced(builder, synced):
    ConsentAddSynced(builder, synced)


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


def End(builder):
    return ConsentEnd(builder)
