// 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';

import { PlanetRouteLoadType } from '../order/planet-route-load-type.js';


export class CommandPlanetRouteRemove implements flatbuffers.IUnpackableObject<CommandPlanetRouteRemoveT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):CommandPlanetRouteRemove {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

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

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

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

loadType():PlanetRouteLoadType {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.readInt8(this.bb_pos + offset) : PlanetRouteLoadType.UNKNOWN;
}

static startCommandPlanetRouteRemove(builder:flatbuffers.Builder) {
  builder.startObject(2);
}

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

static addLoadType(builder:flatbuffers.Builder, loadType:PlanetRouteLoadType) {
  builder.addFieldInt8(1, loadType, PlanetRouteLoadType.UNKNOWN);
}

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

static createCommandPlanetRouteRemove(builder:flatbuffers.Builder, origin:bigint, loadType:PlanetRouteLoadType):flatbuffers.Offset {
  CommandPlanetRouteRemove.startCommandPlanetRouteRemove(builder);
  CommandPlanetRouteRemove.addOrigin(builder, origin);
  CommandPlanetRouteRemove.addLoadType(builder, loadType);
  return CommandPlanetRouteRemove.endCommandPlanetRouteRemove(builder);
}

unpack(): CommandPlanetRouteRemoveT {
  return new CommandPlanetRouteRemoveT(
    this.origin(),
    this.loadType()
  );
}


unpackTo(_o: CommandPlanetRouteRemoveT): void {
  _o.origin = this.origin();
  _o.loadType = this.loadType();
}
}

export class CommandPlanetRouteRemoveT implements flatbuffers.IGeneratedObject {
constructor(
  public origin: bigint = BigInt('0'),
  public loadType: PlanetRouteLoadType = PlanetRouteLoadType.UNKNOWN
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  return CommandPlanetRouteRemove.createCommandPlanetRouteRemove(builder,
    this.origin,
    this.loadType
  );
}
}
