// 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 { ApplicationSummary, ApplicationSummaryT } from '../lobby/application-summary.js';


export class ApplicationSubmitResponse implements flatbuffers.IUnpackableObject<ApplicationSubmitResponseT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):ApplicationSubmitResponse {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

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

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

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

static startApplicationSubmitResponse(builder:flatbuffers.Builder) {
  builder.startObject(1);
}

static addApplication(builder:flatbuffers.Builder, applicationOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, applicationOffset, 0);
}

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

static createApplicationSubmitResponse(builder:flatbuffers.Builder, applicationOffset:flatbuffers.Offset):flatbuffers.Offset {
  ApplicationSubmitResponse.startApplicationSubmitResponse(builder);
  ApplicationSubmitResponse.addApplication(builder, applicationOffset);
  return ApplicationSubmitResponse.endApplicationSubmitResponse(builder);
}

unpack(): ApplicationSubmitResponseT {
  return new ApplicationSubmitResponseT(
    (this.application() !== null ? this.application()!.unpack() : null)
  );
}


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

export class ApplicationSubmitResponseT implements flatbuffers.IGeneratedObject {
constructor(
  public application: ApplicationSummaryT|null = null
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  const application = (this.application !== null ? this.application!.pack(builder) : 0);

  return ApplicationSubmitResponse.createApplicationSubmitResponse(builder,
    application
  );
}
}
