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

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

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

static startUninhabitedPlanet(builder:flatbuffers.Builder) {
  builder.startObject(8);
}

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 endUninhabitedPlanet(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  return offset;
}

static createUninhabitedPlanet(builder:flatbuffers.Builder, x:number, y:number, number:bigint, size:number, nameOffset:flatbuffers.Offset, resources:number, capital:number, material:number):flatbuffers.Offset {
  UninhabitedPlanet.startUninhabitedPlanet(builder);
  UninhabitedPlanet.addX(builder, x);
  UninhabitedPlanet.addY(builder, y);
  UninhabitedPlanet.addNumber(builder, number);
  UninhabitedPlanet.addSize(builder, size);
  UninhabitedPlanet.addName(builder, nameOffset);
  UninhabitedPlanet.addResources(builder, resources);
  UninhabitedPlanet.addCapital(builder, capital);
  UninhabitedPlanet.addMaterial(builder, material);
  return UninhabitedPlanet.endUninhabitedPlanet(builder);
}

unpack(): UninhabitedPlanetT {
  return new UninhabitedPlanetT(
    this.x(),
    this.y(),
    this.number(),
    this.size(),
    this.name(),
    this.resources(),
    this.capital(),
    this.material()
  );
}


unpackTo(_o: UninhabitedPlanetT): 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();
}
}

export class UninhabitedPlanetT 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
){}


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

  return UninhabitedPlanet.createUninhabitedPlanet(builder,
    this.x,
    this.y,
    this.number,
    this.size,
    name,
    this.resources,
    this.capital,
    this.material
  );
}
}
