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

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

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

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

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

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

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

size():number {
  const offset = this.bb!.__offset(this.bb_pos, 12);
  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, 14);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

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

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

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

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

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

colonists():number {
  const offset = this.bb!.__offset(this.bb_pos, 26);
  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, 28);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

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

static startOtherPlanet(builder:flatbuffers.Builder) {
  builder.startObject(14);
}

static addOwner(builder:flatbuffers.Builder, ownerOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, ownerOffset, 0);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static createOtherPlanet(builder:flatbuffers.Builder, ownerOffset:flatbuffers.Offset, 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 {
  OtherPlanet.startOtherPlanet(builder);
  OtherPlanet.addOwner(builder, ownerOffset);
  OtherPlanet.addX(builder, x);
  OtherPlanet.addY(builder, y);
  OtherPlanet.addNumber(builder, number);
  OtherPlanet.addSize(builder, size);
  OtherPlanet.addName(builder, nameOffset);
  OtherPlanet.addResources(builder, resources);
  OtherPlanet.addCapital(builder, capital);
  OtherPlanet.addMaterial(builder, material);
  OtherPlanet.addIndustry(builder, industry);
  OtherPlanet.addPopulation(builder, population);
  OtherPlanet.addColonists(builder, colonists);
  OtherPlanet.addProduction(builder, productionOffset);
  OtherPlanet.addFreeIndustry(builder, freeIndustry);
  return OtherPlanet.endOtherPlanet(builder);
}

unpack(): OtherPlanetT {
  return new OtherPlanetT(
    this.owner(),
    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: OtherPlanetT): void {
  _o.owner = this.owner();
  _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 OtherPlanetT implements flatbuffers.IGeneratedObject {
constructor(
  public owner: string|Uint8Array|null = null,
  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 owner = (this.owner !== null ? builder.createString(this.owner!) : 0);
  const name = (this.name !== null ? builder.createString(this.name!) : 0);
  const production = (this.production !== null ? builder.createString(this.production!) : 0);

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