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

import * as flatbuffers from 'flatbuffers';

import { Session } from '../scrabblefb/session.js';


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

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

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

status():string|null
status(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
status(optionalEncoding?:any):string|Uint8Array|null {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

secondaryUserId():string|null
secondaryUserId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
secondaryUserId(optionalEncoding?:any):string|Uint8Array|null {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

secondaryDisplayName():string|null
secondaryDisplayName(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
secondaryDisplayName(optionalEncoding?:any):string|Uint8Array|null {
  const offset = this.bb!.__offset(this.bb_pos, 8);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

secondaryGames():number {
  const offset = this.bb!.__offset(this.bb_pos, 10);
  return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}

secondaryFriends():number {
  const offset = this.bb!.__offset(this.bb_pos, 12);
  return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}

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

static startLinkResult(builder:flatbuffers.Builder) {
  builder.startObject(6);
}

static addStatus(builder:flatbuffers.Builder, statusOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, statusOffset, 0);
}

static addSecondaryUserId(builder:flatbuffers.Builder, secondaryUserIdOffset:flatbuffers.Offset) {
  builder.addFieldOffset(1, secondaryUserIdOffset, 0);
}

static addSecondaryDisplayName(builder:flatbuffers.Builder, secondaryDisplayNameOffset:flatbuffers.Offset) {
  builder.addFieldOffset(2, secondaryDisplayNameOffset, 0);
}

static addSecondaryGames(builder:flatbuffers.Builder, secondaryGames:number) {
  builder.addFieldInt32(3, secondaryGames, 0);
}

static addSecondaryFriends(builder:flatbuffers.Builder, secondaryFriends:number) {
  builder.addFieldInt32(4, secondaryFriends, 0);
}

static addSession(builder:flatbuffers.Builder, sessionOffset:flatbuffers.Offset) {
  builder.addFieldOffset(5, sessionOffset, 0);
}

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

}
