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

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

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

gameId():string|null
gameId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
gameId(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;
}

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

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

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

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

minPlayers():number {
  const offset = this.bb!.__offset(this.bb_pos, 14);
  return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}

maxPlayers():number {
  const offset = this.bb!.__offset(this.bb_pos, 16);
  return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}

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

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

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

currentTurn():number {
  const offset = this.bb!.__offset(this.bb_pos, 24);
  return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}

static startGameSummary(builder:flatbuffers.Builder) {
  builder.startObject(11);
}

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

static addGameName(builder:flatbuffers.Builder, gameNameOffset:flatbuffers.Offset) {
  builder.addFieldOffset(1, gameNameOffset, 0);
}

static addGameType(builder:flatbuffers.Builder, gameTypeOffset:flatbuffers.Offset) {
  builder.addFieldOffset(2, gameTypeOffset, 0);
}

static addStatus(builder:flatbuffers.Builder, statusOffset:flatbuffers.Offset) {
  builder.addFieldOffset(3, statusOffset, 0);
}

static addOwnerUserId(builder:flatbuffers.Builder, ownerUserIdOffset:flatbuffers.Offset) {
  builder.addFieldOffset(4, ownerUserIdOffset, 0);
}

static addMinPlayers(builder:flatbuffers.Builder, minPlayers:number) {
  builder.addFieldInt32(5, minPlayers, 0);
}

static addMaxPlayers(builder:flatbuffers.Builder, maxPlayers:number) {
  builder.addFieldInt32(6, maxPlayers, 0);
}

static addEnrollmentEndsAtMs(builder:flatbuffers.Builder, enrollmentEndsAtMs:bigint) {
  builder.addFieldInt64(7, enrollmentEndsAtMs, BigInt('0'));
}

static addCreatedAtMs(builder:flatbuffers.Builder, createdAtMs:bigint) {
  builder.addFieldInt64(8, createdAtMs, BigInt('0'));
}

static addUpdatedAtMs(builder:flatbuffers.Builder, updatedAtMs:bigint) {
  builder.addFieldInt64(9, updatedAtMs, BigInt('0'));
}

static addCurrentTurn(builder:flatbuffers.Builder, currentTurn:number) {
  builder.addFieldInt32(10, currentTurn, 0);
}

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

static createGameSummary(builder:flatbuffers.Builder, gameIdOffset:flatbuffers.Offset, gameNameOffset:flatbuffers.Offset, gameTypeOffset:flatbuffers.Offset, statusOffset:flatbuffers.Offset, ownerUserIdOffset:flatbuffers.Offset, minPlayers:number, maxPlayers:number, enrollmentEndsAtMs:bigint, createdAtMs:bigint, updatedAtMs:bigint, currentTurn:number):flatbuffers.Offset {
  GameSummary.startGameSummary(builder);
  GameSummary.addGameId(builder, gameIdOffset);
  GameSummary.addGameName(builder, gameNameOffset);
  GameSummary.addGameType(builder, gameTypeOffset);
  GameSummary.addStatus(builder, statusOffset);
  GameSummary.addOwnerUserId(builder, ownerUserIdOffset);
  GameSummary.addMinPlayers(builder, minPlayers);
  GameSummary.addMaxPlayers(builder, maxPlayers);
  GameSummary.addEnrollmentEndsAtMs(builder, enrollmentEndsAtMs);
  GameSummary.addCreatedAtMs(builder, createdAtMs);
  GameSummary.addUpdatedAtMs(builder, updatedAtMs);
  GameSummary.addCurrentTurn(builder, currentTurn);
  return GameSummary.endGameSummary(builder);
}

unpack(): GameSummaryT {
  return new GameSummaryT(
    this.gameId(),
    this.gameName(),
    this.gameType(),
    this.status(),
    this.ownerUserId(),
    this.minPlayers(),
    this.maxPlayers(),
    this.enrollmentEndsAtMs(),
    this.createdAtMs(),
    this.updatedAtMs(),
    this.currentTurn()
  );
}


unpackTo(_o: GameSummaryT): void {
  _o.gameId = this.gameId();
  _o.gameName = this.gameName();
  _o.gameType = this.gameType();
  _o.status = this.status();
  _o.ownerUserId = this.ownerUserId();
  _o.minPlayers = this.minPlayers();
  _o.maxPlayers = this.maxPlayers();
  _o.enrollmentEndsAtMs = this.enrollmentEndsAtMs();
  _o.createdAtMs = this.createdAtMs();
  _o.updatedAtMs = this.updatedAtMs();
  _o.currentTurn = this.currentTurn();
}
}

export class GameSummaryT implements flatbuffers.IGeneratedObject {
constructor(
  public gameId: string|Uint8Array|null = null,
  public gameName: string|Uint8Array|null = null,
  public gameType: string|Uint8Array|null = null,
  public status: string|Uint8Array|null = null,
  public ownerUserId: string|Uint8Array|null = null,
  public minPlayers: number = 0,
  public maxPlayers: number = 0,
  public enrollmentEndsAtMs: bigint = BigInt('0'),
  public createdAtMs: bigint = BigInt('0'),
  public updatedAtMs: bigint = BigInt('0'),
  public currentTurn: number = 0
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  const gameId = (this.gameId !== null ? builder.createString(this.gameId!) : 0);
  const gameName = (this.gameName !== null ? builder.createString(this.gameName!) : 0);
  const gameType = (this.gameType !== null ? builder.createString(this.gameType!) : 0);
  const status = (this.status !== null ? builder.createString(this.status!) : 0);
  const ownerUserId = (this.ownerUserId !== null ? builder.createString(this.ownerUserId!) : 0);

  return GameSummary.createGameSummary(builder,
    gameId,
    gameName,
    gameType,
    status,
    ownerUserId,
    this.minPlayers,
    this.maxPlayers,
    this.enrollmentEndsAtMs,
    this.createdAtMs,
    this.updatedAtMs,
    this.currentTurn
  );
}
}
