// 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 { UUID, UUIDT } from '../common/uuid.js'; import { CommandItem, CommandItemT } from '../order/command-item.js'; export class UserGamesCommand implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):UserGamesCommand { this.bb_pos = i; this.bb = bb; return this; } static getRootAsUserGamesCommand(bb:flatbuffers.ByteBuffer, obj?:UserGamesCommand):UserGamesCommand { return (obj || new UserGamesCommand()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsUserGamesCommand(bb:flatbuffers.ByteBuffer, obj?:UserGamesCommand):UserGamesCommand { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new UserGamesCommand()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } gameId(obj?:UUID):UUID|null { const offset = this.bb!.__offset(this.bb_pos, 4); return offset ? (obj || new UUID()).__init(this.bb_pos + offset, this.bb!) : null; } commands(index: number, obj?:CommandItem):CommandItem|null { const offset = this.bb!.__offset(this.bb_pos, 6); return offset ? (obj || new CommandItem()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; } commandsLength():number { const offset = this.bb!.__offset(this.bb_pos, 6); return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; } static startUserGamesCommand(builder:flatbuffers.Builder) { builder.startObject(2); } static addGameId(builder:flatbuffers.Builder, gameIdOffset:flatbuffers.Offset) { builder.addFieldStruct(0, gameIdOffset, 0); } static addCommands(builder:flatbuffers.Builder, commandsOffset:flatbuffers.Offset) { builder.addFieldOffset(1, commandsOffset, 0); } static createCommandsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { builder.startVector(4, data.length, 4); for (let i = data.length - 1; i >= 0; i--) { builder.addOffset(data[i]!); } return builder.endVector(); } static startCommandsVector(builder:flatbuffers.Builder, numElems:number) { builder.startVector(4, numElems, 4); } static endUserGamesCommand(builder:flatbuffers.Builder):flatbuffers.Offset { const offset = builder.endObject(); builder.requiredField(offset, 4) // game_id return offset; } static createUserGamesCommand(builder:flatbuffers.Builder, gameIdOffset:flatbuffers.Offset, commandsOffset:flatbuffers.Offset):flatbuffers.Offset { UserGamesCommand.startUserGamesCommand(builder); UserGamesCommand.addGameId(builder, gameIdOffset); UserGamesCommand.addCommands(builder, commandsOffset); return UserGamesCommand.endUserGamesCommand(builder); } unpack(): UserGamesCommandT { return new UserGamesCommandT( (this.gameId() !== null ? this.gameId()!.unpack() : null), this.bb!.createObjList(this.commands.bind(this), this.commandsLength()) ); } unpackTo(_o: UserGamesCommandT): void { _o.gameId = (this.gameId() !== null ? this.gameId()!.unpack() : null); _o.commands = this.bb!.createObjList(this.commands.bind(this), this.commandsLength()); } } export class UserGamesCommandT implements flatbuffers.IGeneratedObject { constructor( public gameId: UUIDT|null = null, public commands: (CommandItemT)[] = [] ){} pack(builder:flatbuffers.Builder): flatbuffers.Offset { const commands = UserGamesCommand.createCommandsVector(builder, builder.createObjectOffsetList(this.commands)); return UserGamesCommand.createUserGamesCommand(builder, (this.gameId !== null ? this.gameId!.pack(builder) : 0), commands ); } }