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

import * as flatbuffers from 'flatbuffers';

import { GameView } from '../scrabblefb/game-view.js';


export class GameOverEvent {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):GameOverEvent {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

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

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

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

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

game(obj?:GameView):GameView|null {
  const offset = this.bb!.__offset(this.bb_pos, 10);
  return offset ? (obj || new GameView()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}

static startGameOverEvent(builder:flatbuffers.Builder) {
  builder.startObject(4);
}

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

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

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

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

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

}
