// automatically generated by the FlatBuffers compiler, do not modify

/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */

import * as flatbuffers from 'flatbuffers';



export class MailRecipientState implements flatbuffers.IUnpackableObject<MailRecipientStateT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):MailRecipientState {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

static getRootAsMailRecipientState(bb:flatbuffers.ByteBuffer, obj?:MailRecipientState):MailRecipientState {
  return (obj || new MailRecipientState()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

static getSizePrefixedRootAsMailRecipientState(bb:flatbuffers.ByteBuffer, obj?:MailRecipientState):MailRecipientState {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new MailRecipientState()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

messageId():string|null
messageId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
messageId(optionalEncoding?:any):string|Uint8Array|null {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

readAtMs():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}

deletedAtMs():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 8);
  return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}

static startMailRecipientState(builder:flatbuffers.Builder) {
  builder.startObject(3);
}

static addMessageId(builder:flatbuffers.Builder, messageIdOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, messageIdOffset, 0);
}

static addReadAtMs(builder:flatbuffers.Builder, readAtMs:bigint) {
  builder.addFieldInt64(1, readAtMs, BigInt('0'));
}

static addDeletedAtMs(builder:flatbuffers.Builder, deletedAtMs:bigint) {
  builder.addFieldInt64(2, deletedAtMs, BigInt('0'));
}

static endMailRecipientState(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  return offset;
}

static createMailRecipientState(builder:flatbuffers.Builder, messageIdOffset:flatbuffers.Offset, readAtMs:bigint, deletedAtMs:bigint):flatbuffers.Offset {
  MailRecipientState.startMailRecipientState(builder);
  MailRecipientState.addMessageId(builder, messageIdOffset);
  MailRecipientState.addReadAtMs(builder, readAtMs);
  MailRecipientState.addDeletedAtMs(builder, deletedAtMs);
  return MailRecipientState.endMailRecipientState(builder);
}

unpack(): MailRecipientStateT {
  return new MailRecipientStateT(
    this.messageId(),
    this.readAtMs(),
    this.deletedAtMs()
  );
}


unpackTo(_o: MailRecipientStateT): void {
  _o.messageId = this.messageId();
  _o.readAtMs = this.readAtMs();
  _o.deletedAtMs = this.deletedAtMs();
}
}

export class MailRecipientStateT implements flatbuffers.IGeneratedObject {
constructor(
  public messageId: string|Uint8Array|null = null,
  public readAtMs: bigint = BigInt('0'),
  public deletedAtMs: bigint = BigInt('0')
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  const messageId = (this.messageId !== null ? builder.createString(this.messageId!) : 0);

  return MailRecipientState.createMailRecipientState(builder,
    messageId,
    this.readAtMs,
    this.deletedAtMs
  );
}
}
