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

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

static getSizePrefixedRootAsGameReportRequest(bb:flatbuffers.ByteBuffer, obj?:GameReportRequest):GameReportRequest {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new GameReportRequest()).__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;
}

turn():number {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
}

static startGameReportRequest(builder:flatbuffers.Builder) {
  builder.startObject(2);
}

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

static addTurn(builder:flatbuffers.Builder, turn:number) {
  builder.addFieldInt32(1, turn, 0);
}

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

static createGameReportRequest(builder:flatbuffers.Builder, gameIdOffset:flatbuffers.Offset, turn:number):flatbuffers.Offset {
  GameReportRequest.startGameReportRequest(builder);
  GameReportRequest.addGameId(builder, gameIdOffset);
  GameReportRequest.addTurn(builder, turn);
  return GameReportRequest.endGameReportRequest(builder);
}

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


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

export class GameReportRequestT implements flatbuffers.IGeneratedObject {
constructor(
  public gameId: UUIDT|null = null,
  public turn: number = 0
){}


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