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

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

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

x():number {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

y():number {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

number():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 8);
  return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
}

size():number {
  const offset = this.bb!.__offset(this.bb_pos, 10);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

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

resources():number {
  const offset = this.bb!.__offset(this.bb_pos, 14);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

capital():number {
  const offset = this.bb!.__offset(this.bb_pos, 16);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

material():number {
  const offset = this.bb!.__offset(this.bb_pos, 18);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

industry():number {
  const offset = this.bb!.__offset(this.bb_pos, 20);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

population():number {
  const offset = this.bb!.__offset(this.bb_pos, 22);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

colonists():number {
  const offset = this.bb!.__offset(this.bb_pos, 24);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

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

freeIndustry():number {
  const offset = this.bb!.__offset(this.bb_pos, 28);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

static startLocalPlanet(builder:flatbuffers.Builder) {
  builder.startObject(13);
}

static addX(builder:flatbuffers.Builder, x:number) {
  builder.addFieldFloat32(0, x, 0.0);
}

static addY(builder:flatbuffers.Builder, y:number) {
  builder.addFieldFloat32(1, y, 0.0);
}

static addNumber(builder:flatbuffers.Builder, number:bigint) {
  builder.addFieldInt64(2, number, BigInt('0'));
}

static addSize(builder:flatbuffers.Builder, size:number) {
  builder.addFieldFloat32(3, size, 0.0);
}

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

static addResources(builder:flatbuffers.Builder, resources:number) {
  builder.addFieldFloat32(5, resources, 0.0);
}

static addCapital(builder:flatbuffers.Builder, capital:number) {
  builder.addFieldFloat32(6, capital, 0.0);
}

static addMaterial(builder:flatbuffers.Builder, material:number) {
  builder.addFieldFloat32(7, material, 0.0);
}

static addIndustry(builder:flatbuffers.Builder, industry:number) {
  builder.addFieldFloat32(8, industry, 0.0);
}

static addPopulation(builder:flatbuffers.Builder, population:number) {
  builder.addFieldFloat32(9, population, 0.0);
}

static addColonists(builder:flatbuffers.Builder, colonists:number) {
  builder.addFieldFloat32(10, colonists, 0.0);
}

static addProduction(builder:flatbuffers.Builder, productionOffset:flatbuffers.Offset) {
  builder.addFieldOffset(11, productionOffset, 0);
}

static addFreeIndustry(builder:flatbuffers.Builder, freeIndustry:number) {
  builder.addFieldFloat32(12, freeIndustry, 0.0);
}

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

static createLocalPlanet(builder:flatbuffers.Builder, x:number, y:number, number:bigint, size:number, nameOffset:flatbuffers.Offset, resources:number, capital:number, material:number, industry:number, population:number, colonists:number, productionOffset:flatbuffers.Offset, freeIndustry:number):flatbuffers.Offset {
  LocalPlanet.startLocalPlanet(builder);
  LocalPlanet.addX(builder, x);
  LocalPlanet.addY(builder, y);
  LocalPlanet.addNumber(builder, number);
  LocalPlanet.addSize(builder, size);
  LocalPlanet.addName(builder, nameOffset);
  LocalPlanet.addResources(builder, resources);
  LocalPlanet.addCapital(builder, capital);
  LocalPlanet.addMaterial(builder, material);
  LocalPlanet.addIndustry(builder, industry);
  LocalPlanet.addPopulation(builder, population);
  LocalPlanet.addColonists(builder, colonists);
  LocalPlanet.addProduction(builder, productionOffset);
  LocalPlanet.addFreeIndustry(builder, freeIndustry);
  return LocalPlanet.endLocalPlanet(builder);
}

unpack(): LocalPlanetT {
  return new LocalPlanetT(
    this.x(),
    this.y(),
    this.number(),
    this.size(),
    this.name(),
    this.resources(),
    this.capital(),
    this.material(),
    this.industry(),
    this.population(),
    this.colonists(),
    this.production(),
    this.freeIndustry()
  );
}


unpackTo(_o: LocalPlanetT): void {
  _o.x = this.x();
  _o.y = this.y();
  _o.number = this.number();
  _o.size = this.size();
  _o.name = this.name();
  _o.resources = this.resources();
  _o.capital = this.capital();
  _o.material = this.material();
  _o.industry = this.industry();
  _o.population = this.population();
  _o.colonists = this.colonists();
  _o.production = this.production();
  _o.freeIndustry = this.freeIndustry();
}
}

export class LocalPlanetT implements flatbuffers.IGeneratedObject {
constructor(
  public x: number = 0.0,
  public y: number = 0.0,
  public number: bigint = BigInt('0'),
  public size: number = 0.0,
  public name: string|Uint8Array|null = null,
  public resources: number = 0.0,
  public capital: number = 0.0,
  public material: number = 0.0,
  public industry: number = 0.0,
  public population: number = 0.0,
  public colonists: number = 0.0,
  public production: string|Uint8Array|null = null,
  public freeIndustry: number = 0.0
){}


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

  return LocalPlanet.createLocalPlanet(builder,
    this.x,
    this.y,
    this.number,
    this.size,
    name,
    this.resources,
    this.capital,
    this.material,
    this.industry,
    this.population,
    this.colonists,
    production,
    this.freeIndustry
  );
}
}
