// 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 SentRequest implements flatbuffers.IUnpackableObject<SentRequestT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):SentRequest {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

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

static getSizePrefixedRootAsSentRequest(bb:flatbuffers.ByteBuffer, obj?:SentRequest):SentRequest {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new SentRequest()).__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 startSentRequest(builder:flatbuffers.Builder) {
  builder.startObject(1);
}

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

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

static createSentRequest(builder:flatbuffers.Builder, gameIdOffset:flatbuffers.Offset):flatbuffers.Offset {
  SentRequest.startSentRequest(builder);
  SentRequest.addGameId(builder, gameIdOffset);
  return SentRequest.endSentRequest(builder);
}

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


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

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


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