# automatically generated by the FlatBuffers compiler, do not modify

# namespace: user

import flatbuffers
from flatbuffers.compat import import_numpy

np = import_numpy()


# User activation tokens.
class ActivationToken(object):
    __slots__ = ["_tab"]

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

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

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

    # OID of user object (primary key, never changes).
    # ActivationToken
    def Oid(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Activation type.
    # ActivationToken
    def Atype(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 0

    # Activation status.
    # ActivationToken
    def Status(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 0

    # Time when the activation was created.
    # ActivationToken
    def Created(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # Time when the activation was completed. The status will signal the outcome.
    # ActivationToken
    def Completed(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

    # Activation code that was sent.
    # ActivationToken
    def Code(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Email address to which the activation was sent.
    # ActivationToken
    def Email(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # User public key for which this activation was created.
    # ActivationToken
    def Pubkey(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None


def ActivationTokenStart(builder):
    builder.StartObject(8)


def Start(builder):
    ActivationTokenStart(builder)


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


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


def ActivationTokenAddAtype(builder, atype):
    builder.PrependInt8Slot(1, atype, 0)


def AddAtype(builder, atype):
    ActivationTokenAddAtype(builder, atype)


def ActivationTokenAddStatus(builder, status):
    builder.PrependInt8Slot(2, status, 0)


def AddStatus(builder, status):
    ActivationTokenAddStatus(builder, status)


def ActivationTokenAddCreated(builder, created):
    builder.PrependUint64Slot(3, created, 0)


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


def ActivationTokenAddCompleted(builder, completed):
    builder.PrependUint64Slot(4, completed, 0)


def AddCompleted(builder, completed):
    ActivationTokenAddCompleted(builder, completed)


def ActivationTokenAddCode(builder, code):
    builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(code), 0)


def AddCode(builder, code):
    ActivationTokenAddCode(builder, code)


def ActivationTokenAddEmail(builder, email):
    builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(email), 0)


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


def ActivationTokenAddPubkey(builder, pubkey):
    builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(pubkey), 0)


def AddPubkey(builder, pubkey):
    ActivationTokenAddPubkey(builder, pubkey)


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


def End(builder):
    return ActivationTokenEnd(builder)
