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


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

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

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

messageId(obj?:UUID):UUID|null {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? (obj || new UUID()).__init(this.bb_pos + offset, this.bb!) : null;
}

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

static addGameId(builder:flatbuffers.Builder, gameIdOffset:flatbuffers.Offset) {
  builder.addFieldStruct(0, gameIdOffset, 0);
}

static addMessageId(builder:flatbuffers.Builder, messageIdOffset:flatbuffers.Offset) {
  builder.addFieldStruct(1, messageIdOffset, 0);
}

static endDeleteRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  builder.requiredField(offset, 4) // game_id
  builder.requiredField(offset, 6) // message_id
  return offset;
}


unpack(): DeleteRequestT {
  return new DeleteRequestT(
    (this.gameId() !== null ? this.gameId()!.unpack() : null),
    (this.messageId() !== null ? this.messageId()!.unpack() : null)
  );
}


unpackTo(_o: DeleteRequestT): void {
  _o.gameId = (this.gameId() !== null ? this.gameId()!.unpack() : null);
  _o.messageId = (this.messageId() !== null ? this.messageId()!.unpack() : null);
}
}

export class DeleteRequestT implements flatbuffers.IGeneratedObject {
constructor(
  public gameId: UUIDT|null = null,
  public messageId: UUIDT|null = null
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  DeleteRequest.startDeleteRequest(builder);
  DeleteRequest.addGameId(builder, (this.gameId !== null ? this.gameId!.pack(builder) : 0));
  DeleteRequest.addMessageId(builder, (this.messageId !== null ? this.messageId!.pack(builder) : 0));

  return DeleteRequest.endDeleteRequest(builder);
}
}
