// 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';

import { UUID, UUIDT } from '../common/uuid.js';


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

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

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

gameId(obj?:UUID):UUID|null {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? (obj || new UUID()).__init(this.bb_pos + offset, this.bb!) : null;
}

static startInboxRequest(builder:flatbuffers.Builder) {
  builder.startObject(1);
}

static addGameId(builder:flatbuffers.Builder, gameIdOffset:flatbuffers.Offset) {
  builder.addFieldStruct(0, gameIdOffset, 0);
}

static endInboxRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  builder.requiredField(offset, 4) // game_id
  return offset;
}

static createInboxRequest(builder:flatbuffers.Builder, gameIdOffset:flatbuffers.Offset):flatbuffers.Offset {
  InboxRequest.startInboxRequest(builder);
  InboxRequest.addGameId(builder, gameIdOffset);
  return InboxRequest.endInboxRequest(builder);
}

unpack(): InboxRequestT {
  return new InboxRequestT(
    (this.gameId() !== null ? this.gameId()!.unpack() : null)
  );
}


unpackTo(_o: InboxRequestT): void {
  _o.gameId = (this.gameId() !== null ? this.gameId()!.unpack() : null);
}
}

export class InboxRequestT implements flatbuffers.IGeneratedObject {
constructor(
  public gameId: UUIDT|null = null
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  return InboxRequest.createInboxRequest(builder,
    (this.gameId !== null ? this.gameId!.pack(builder) : 0)
  );
}
}
