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

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

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

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

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

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

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

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

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

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

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

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

static startGameCreateRequest(builder:flatbuffers.Builder) {
  builder.startObject(9);
}

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

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

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

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

static addStartGapHours(builder:flatbuffers.Builder, startGapHours:number) {
  builder.addFieldInt32(4, startGapHours, 0);
}

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

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

static addTurnSchedule(builder:flatbuffers.Builder, turnScheduleOffset:flatbuffers.Offset) {
  builder.addFieldOffset(7, turnScheduleOffset, 0);
}

static addTargetEngineVersion(builder:flatbuffers.Builder, targetEngineVersionOffset:flatbuffers.Offset) {
  builder.addFieldOffset(8, targetEngineVersionOffset, 0);
}

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

static createGameCreateRequest(builder:flatbuffers.Builder, gameNameOffset:flatbuffers.Offset, descriptionOffset:flatbuffers.Offset, minPlayers:number, maxPlayers:number, startGapHours:number, startGapPlayers:number, enrollmentEndsAtMs:bigint, turnScheduleOffset:flatbuffers.Offset, targetEngineVersionOffset:flatbuffers.Offset):flatbuffers.Offset {
  GameCreateRequest.startGameCreateRequest(builder);
  GameCreateRequest.addGameName(builder, gameNameOffset);
  GameCreateRequest.addDescription(builder, descriptionOffset);
  GameCreateRequest.addMinPlayers(builder, minPlayers);
  GameCreateRequest.addMaxPlayers(builder, maxPlayers);
  GameCreateRequest.addStartGapHours(builder, startGapHours);
  GameCreateRequest.addStartGapPlayers(builder, startGapPlayers);
  GameCreateRequest.addEnrollmentEndsAtMs(builder, enrollmentEndsAtMs);
  GameCreateRequest.addTurnSchedule(builder, turnScheduleOffset);
  GameCreateRequest.addTargetEngineVersion(builder, targetEngineVersionOffset);
  return GameCreateRequest.endGameCreateRequest(builder);
}

unpack(): GameCreateRequestT {
  return new GameCreateRequestT(
    this.gameName(),
    this.description(),
    this.minPlayers(),
    this.maxPlayers(),
    this.startGapHours(),
    this.startGapPlayers(),
    this.enrollmentEndsAtMs(),
    this.turnSchedule(),
    this.targetEngineVersion()
  );
}


unpackTo(_o: GameCreateRequestT): void {
  _o.gameName = this.gameName();
  _o.description = this.description();
  _o.minPlayers = this.minPlayers();
  _o.maxPlayers = this.maxPlayers();
  _o.startGapHours = this.startGapHours();
  _o.startGapPlayers = this.startGapPlayers();
  _o.enrollmentEndsAtMs = this.enrollmentEndsAtMs();
  _o.turnSchedule = this.turnSchedule();
  _o.targetEngineVersion = this.targetEngineVersion();
}
}

export class GameCreateRequestT implements flatbuffers.IGeneratedObject {
constructor(
  public gameName: string|Uint8Array|null = null,
  public description: string|Uint8Array|null = null,
  public minPlayers: number = 0,
  public maxPlayers: number = 0,
  public startGapHours: number = 0,
  public startGapPlayers: number = 0,
  public enrollmentEndsAtMs: bigint = BigInt('0'),
  public turnSchedule: string|Uint8Array|null = null,
  public targetEngineVersion: string|Uint8Array|null = null
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  const gameName = (this.gameName !== null ? builder.createString(this.gameName!) : 0);
  const description = (this.description !== null ? builder.createString(this.description!) : 0);
  const turnSchedule = (this.turnSchedule !== null ? builder.createString(this.turnSchedule!) : 0);
  const targetEngineVersion = (this.targetEngineVersion !== null ? builder.createString(this.targetEngineVersion!) : 0);

  return GameCreateRequest.createGameCreateRequest(builder,
    gameName,
    description,
    this.minPlayers,
    this.maxPlayers,
    this.startGapHours,
    this.startGapPlayers,
    this.enrollmentEndsAtMs,
    turnSchedule,
    targetEngineVersion
  );
}
}
