# automatically generated by the FlatBuffers compiler, do not modify

# namespace: xbrnetwork

import flatbuffers
from flatbuffers.compat import import_numpy

np = import_numpy()


# XBR Network members.
class Account(object):
    __slots__ = ["_tab"]

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

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

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

    # Globally unique and static member ID.
    # Account
    def Oid(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

    # Account
    def OidAsNumpy(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

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

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

    # Timestamp (epoch time in ns) of initial creation of this record.
    # Account
    def Created(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

    # XBR Network username (must be globally unique on https://xbr.network)
    # Account
    def Username(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # User (primary) email address.
    # Account
    def Email(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Timestamp (epoch time in ns) when the user email was (last) verified or 0 if unverified.
    # Account
    def EmailVerified(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # Type of (primary) user crypto wallet in use.
    # Account
    def WalletType(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

    # Public address of user crypto wallet in use.
    # Account
    def WalletAddress(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

    # Account
    def WalletAddressAsNumpy(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

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

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

    # Block number (on the blockchain) when the member (originally) registered.
    # Account
    def Registered(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        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

    # Account
    def RegisteredAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Account
    def RegisteredLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Account
    def RegisteredIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        return o == 0

    # EULA the member agreed to when joining the market (IPFS Multihash string).
    # Account
    def Eula(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

    # Optional member profile (IPFS Multihash string).
    # Account
    def Profile(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

    # Current member level.
    # Account
    def Level(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0


def AccountStart(builder):
    builder.StartObject(11)


def Start(builder):
    AccountStart(builder)


def AccountAddOid(builder, oid):
    builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(oid), 0)


def AddOid(builder, oid):
    AccountAddOid(builder, oid)


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


def StartOidVector(builder, numElems: int) -> int:
    return AccountStartOidVector(builder, numElems)


def AccountAddCreated(builder, created):
    builder.PrependUint64Slot(1, created, 0)


def AddCreated(builder, created):
    AccountAddCreated(builder, created)


def AccountAddUsername(builder, username):
    builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(username), 0)


def AddUsername(builder, username):
    AccountAddUsername(builder, username)


def AccountAddEmail(builder, email):
    builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(email), 0)


def AddEmail(builder, email):
    AccountAddEmail(builder, email)


def AccountAddEmailVerified(builder, emailVerified):
    builder.PrependUint64Slot(4, emailVerified, 0)


def AddEmailVerified(builder, emailVerified):
    AccountAddEmailVerified(builder, emailVerified)


def AccountAddWalletType(builder, walletType):
    builder.PrependUint8Slot(5, walletType, 0)


def AddWalletType(builder, walletType):
    AccountAddWalletType(builder, walletType)


def AccountAddWalletAddress(builder, walletAddress):
    builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(walletAddress), 0)


def AddWalletAddress(builder, walletAddress):
    AccountAddWalletAddress(builder, walletAddress)


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


def StartWalletAddressVector(builder, numElems: int) -> int:
    return AccountStartWalletAddressVector(builder, numElems)


def AccountAddRegistered(builder, registered):
    builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(registered), 0)


def AddRegistered(builder, registered):
    AccountAddRegistered(builder, registered)


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


def StartRegisteredVector(builder, numElems: int) -> int:
    return AccountStartRegisteredVector(builder, numElems)


def AccountAddEula(builder, eula):
    builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(eula), 0)


def AddEula(builder, eula):
    AccountAddEula(builder, eula)


def AccountAddProfile(builder, profile):
    builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(profile), 0)


def AddProfile(builder, profile):
    AccountAddProfile(builder, profile)


def AccountAddLevel(builder, level):
    builder.PrependUint8Slot(10, level, 0)


def AddLevel(builder, level):
    AccountAddLevel(builder, level)


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


def End(builder):
    return AccountEnd(builder)
