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

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

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

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

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

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

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

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

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

static createCommandPlanetRename(builder:flatbuffers.Builder, number:bigint, nameOffset:flatbuffers.Offset):flatbuffers.Offset {
  CommandPlanetRename.startCommandPlanetRename(builder);
  CommandPlanetRename.addNumber(builder, number);
  CommandPlanetRename.addName(builder, nameOffset);
  return CommandPlanetRename.endCommandPlanetRename(builder);
}

unpack(): CommandPlanetRenameT {
  return new CommandPlanetRenameT(
    this.number(),
    this.name()
  );
}


unpackTo(_o: CommandPlanetRenameT): void {
  _o.number = this.number();
  _o.name = this.name();
}
}

export class CommandPlanetRenameT implements flatbuffers.IGeneratedObject {
constructor(
  public number: bigint = BigInt('0'),
  public name: string|Uint8Array|null = null
){}


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

  return CommandPlanetRename.createCommandPlanetRename(builder,
    this.number,
    name
  );
}
}
