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

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

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

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

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

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

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

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

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

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

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

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

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

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

wiped():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 26);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

static startBombing(builder:flatbuffers.Builder) {
  builder.startObject(12);
}

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

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

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

static addAttacker(builder:flatbuffers.Builder, attackerOffset:flatbuffers.Offset) {
  builder.addFieldOffset(3, attackerOffset, 0);
}

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

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

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

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

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

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

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

static addWiped(builder:flatbuffers.Builder, wiped:boolean) {
  builder.addFieldInt8(11, +wiped, +false);
}

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

static createBombing(builder:flatbuffers.Builder, number:bigint, planetOffset:flatbuffers.Offset, ownerOffset:flatbuffers.Offset, attackerOffset:flatbuffers.Offset, productionOffset:flatbuffers.Offset, industry:number, population:number, colonists:number, capital:number, material:number, attackPower:number, wiped:boolean):flatbuffers.Offset {
  Bombing.startBombing(builder);
  Bombing.addNumber(builder, number);
  Bombing.addPlanet(builder, planetOffset);
  Bombing.addOwner(builder, ownerOffset);
  Bombing.addAttacker(builder, attackerOffset);
  Bombing.addProduction(builder, productionOffset);
  Bombing.addIndustry(builder, industry);
  Bombing.addPopulation(builder, population);
  Bombing.addColonists(builder, colonists);
  Bombing.addCapital(builder, capital);
  Bombing.addMaterial(builder, material);
  Bombing.addAttackPower(builder, attackPower);
  Bombing.addWiped(builder, wiped);
  return Bombing.endBombing(builder);
}

unpack(): BombingT {
  return new BombingT(
    this.number(),
    this.planet(),
    this.owner(),
    this.attacker(),
    this.production(),
    this.industry(),
    this.population(),
    this.colonists(),
    this.capital(),
    this.material(),
    this.attackPower(),
    this.wiped()
  );
}


unpackTo(_o: BombingT): void {
  _o.number = this.number();
  _o.planet = this.planet();
  _o.owner = this.owner();
  _o.attacker = this.attacker();
  _o.production = this.production();
  _o.industry = this.industry();
  _o.population = this.population();
  _o.colonists = this.colonists();
  _o.capital = this.capital();
  _o.material = this.material();
  _o.attackPower = this.attackPower();
  _o.wiped = this.wiped();
}
}

export class BombingT implements flatbuffers.IGeneratedObject {
constructor(
  public number: bigint = BigInt('0'),
  public planet: string|Uint8Array|null = null,
  public owner: string|Uint8Array|null = null,
  public attacker: string|Uint8Array|null = null,
  public production: string|Uint8Array|null = null,
  public industry: number = 0.0,
  public population: number = 0.0,
  public colonists: number = 0.0,
  public capital: number = 0.0,
  public material: number = 0.0,
  public attackPower: number = 0.0,
  public wiped: boolean = false
){}


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

  return Bombing.createBombing(builder,
    this.number,
    planet,
    owner,
    attacker,
    production,
    this.industry,
    this.population,
    this.colonists,
    this.capital,
    this.material,
    this.attackPower,
    this.wiped
  );
}
}
