// 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 { InviteSummary, InviteSummaryT } from '../lobby/invite-summary.js';


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

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

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

invite(obj?:InviteSummary):InviteSummary|null {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? (obj || new InviteSummary()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}

static startInviteDeclineResponse(builder:flatbuffers.Builder) {
  builder.startObject(1);
}

static addInvite(builder:flatbuffers.Builder, inviteOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, inviteOffset, 0);
}

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

static createInviteDeclineResponse(builder:flatbuffers.Builder, inviteOffset:flatbuffers.Offset):flatbuffers.Offset {
  InviteDeclineResponse.startInviteDeclineResponse(builder);
  InviteDeclineResponse.addInvite(builder, inviteOffset);
  return InviteDeclineResponse.endInviteDeclineResponse(builder);
}

unpack(): InviteDeclineResponseT {
  return new InviteDeclineResponseT(
    (this.invite() !== null ? this.invite()!.unpack() : null)
  );
}


unpackTo(_o: InviteDeclineResponseT): void {
  _o.invite = (this.invite() !== null ? this.invite()!.unpack() : null);
}
}

export class InviteDeclineResponseT implements flatbuffers.IGeneratedObject {
constructor(
  public invite: InviteSummaryT|null = null
){}


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

  return InviteDeclineResponse.createInviteDeclineResponse(builder,
    invite
  );
}
}
