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

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

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

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

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

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

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

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

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

static startShipProduction(builder:flatbuffers.Builder) {
  builder.startObject(6);
}

static addPlanet(builder:flatbuffers.Builder, planet:bigint) {
  builder.addFieldInt64(0, planet, BigInt('0'));
}

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

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

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

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

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

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

static createShipProduction(builder:flatbuffers.Builder, planet:bigint, class_Offset:flatbuffers.Offset, cost:number, prodUsed:number, percent:number, free:number):flatbuffers.Offset {
  ShipProduction.startShipProduction(builder);
  ShipProduction.addPlanet(builder, planet);
  ShipProduction.addClass(builder, class_Offset);
  ShipProduction.addCost(builder, cost);
  ShipProduction.addProdUsed(builder, prodUsed);
  ShipProduction.addPercent(builder, percent);
  ShipProduction.addFree(builder, free);
  return ShipProduction.endShipProduction(builder);
}

unpack(): ShipProductionT {
  return new ShipProductionT(
    this.planet(),
    this.class_(),
    this.cost(),
    this.prodUsed(),
    this.percent(),
    this.free()
  );
}


unpackTo(_o: ShipProductionT): void {
  _o.planet = this.planet();
  _o.class_ = this.class_();
  _o.cost = this.cost();
  _o.prodUsed = this.prodUsed();
  _o.percent = this.percent();
  _o.free = this.free();
}
}

export class ShipProductionT implements flatbuffers.IGeneratedObject {
constructor(
  public planet: bigint = BigInt('0'),
  public class_: string|Uint8Array|null = null,
  public cost: number = 0.0,
  public prodUsed: number = 0.0,
  public percent: number = 0.0,
  public free: number = 0.0
){}


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

  return ShipProduction.createShipProduction(builder,
    this.planet,
    class_,
    this.cost,
    this.prodUsed,
    this.percent,
    this.free
  );
}
}
