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

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

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

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

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

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

static startCommandScienceCreate(builder:flatbuffers.Builder) {
  builder.startObject(5);
}

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 addWeapons(builder:flatbuffers.Builder, weapons:number) {
  builder.addFieldFloat64(2, weapons, 0.0);
}

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

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

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

static createCommandScienceCreate(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, drive:number, weapons:number, shields:number, cargo:number):flatbuffers.Offset {
  CommandScienceCreate.startCommandScienceCreate(builder);
  CommandScienceCreate.addName(builder, nameOffset);
  CommandScienceCreate.addDrive(builder, drive);
  CommandScienceCreate.addWeapons(builder, weapons);
  CommandScienceCreate.addShields(builder, shields);
  CommandScienceCreate.addCargo(builder, cargo);
  return CommandScienceCreate.endCommandScienceCreate(builder);
}

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


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

export class CommandScienceCreateT implements flatbuffers.IGeneratedObject {
constructor(
  public name: string|Uint8Array|null = null,
  public drive: number = 0.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 CommandScienceCreate.createCommandScienceCreate(builder,
    name,
    this.drive,
    this.weapons,
    this.shields,
    this.cargo
  );
}
}
