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

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

static getSizePrefixedRootAsInviteRedeemResponse(bb:flatbuffers.ByteBuffer, obj?:InviteRedeemResponse):InviteRedeemResponse {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new InviteRedeemResponse()).__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 startInviteRedeemResponse(builder:flatbuffers.Builder) {
  builder.startObject(1);
}

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

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

static createInviteRedeemResponse(builder:flatbuffers.Builder, inviteOffset:flatbuffers.Offset):flatbuffers.Offset {
  InviteRedeemResponse.startInviteRedeemResponse(builder);
  InviteRedeemResponse.addInvite(builder, inviteOffset);
  return InviteRedeemResponse.endInviteRedeemResponse(builder);
}

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


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

export class InviteRedeemResponseT 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 InviteRedeemResponse.createInviteRedeemResponse(builder,
    invite
  );
}
}
