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

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

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

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

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

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

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

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

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

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

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

static addDrive(builder:flatbuffers.Builder, drive:number) {
  builder.addFieldFloat64(1, drive, 0.0);
}

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

static addWeapons(builder:flatbuffers.Builder, weapons:number) {
  builder.addFieldFloat64(3, weapons, 0.0);
}

static addShields(builder:flatbuffers.Builder, shields:number) {
  builder.addFieldFloat64(4, shields, 0.0);
}

static addCargo(builder:flatbuffers.Builder, cargo:number) {
  builder.addFieldFloat64(5, cargo, 0.0);
}

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

static createCommandShipClassCreate(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, drive:number, armament:bigint, weapons:number, shields:number, cargo:number):flatbuffers.Offset {
  CommandShipClassCreate.startCommandShipClassCreate(builder);
  CommandShipClassCreate.addName(builder, nameOffset);
  CommandShipClassCreate.addDrive(builder, drive);
  CommandShipClassCreate.addArmament(builder, armament);
  CommandShipClassCreate.addWeapons(builder, weapons);
  CommandShipClassCreate.addShields(builder, shields);
  CommandShipClassCreate.addCargo(builder, cargo);
  return CommandShipClassCreate.endCommandShipClassCreate(builder);
}

unpack(): CommandShipClassCreateT {
  return new CommandShipClassCreateT(
    this.name(),
    this.drive(),
    this.armament(),
    this.weapons(),
    this.shields(),
    this.cargo()
  );
}


unpackTo(_o: CommandShipClassCreateT): void {
  _o.name = this.name();
  _o.drive = this.drive();
  _o.armament = this.armament();
  _o.weapons = this.weapons();
  _o.shields = this.shields();
  _o.cargo = this.cargo();
}
}

export class CommandShipClassCreateT implements flatbuffers.IGeneratedObject {
constructor(
  public name: string|Uint8Array|null = null,
  public drive: number = 0.0,
  public armament: bigint = BigInt('0'),
  public weapons: number = 0.0,
  public shields: number = 0.0,
  public cargo: number = 0.0
){}


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

  return CommandShipClassCreate.createCommandShipClassCreate(builder,
    name,
    this.drive,
    this.armament,
    this.weapons,
    this.shields,
    this.cargo
  );
}
}
