// automatically generated by the FlatBuffers compiler, do not modify

import * as flatbuffers from 'flatbuffers';

import { AccountRef } from '../scrabblefb/account-ref.js';


export class RedeemResult {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):RedeemResult {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

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

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

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

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

static addFriend(builder:flatbuffers.Builder, friendOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, friendOffset, 0);
}

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

static createRedeemResult(builder:flatbuffers.Builder, friendOffset:flatbuffers.Offset):flatbuffers.Offset {
  RedeemResult.startRedeemResult(builder);
  RedeemResult.addFriend(builder, friendOffset);
  return RedeemResult.endRedeemResult(builder);
}
}
