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

import * as flatbuffers from 'flatbuffers';

import { AdsInfo } from '../scrabblefb/ads-info.js';
import { BannerInfo } from '../scrabblefb/banner-info.js';
import { DictVersion } from '../scrabblefb/dict-version.js';
import { GameLimits } from '../scrabblefb/game-limits.js';


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

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

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

userId():string|null
userId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
userId(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;
}

displayName():string|null
displayName(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
displayName(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;
}

preferredLanguage():string|null
preferredLanguage(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
preferredLanguage(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;
}

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

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

blockChat():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 14);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

blockFriendRequests():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 16);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

isGuest():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 18);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

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

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

notificationsInAppOnly():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 24);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : true;
}

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

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

variantPreferencesLength():number {
  const offset = this.bb!.__offset(this.bb_pos, 28);
  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}

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

telegramLinked():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 32);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

vkLinked():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 34);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

dictVersions(index: number, obj?:DictVersion):DictVersion|null {
  const offset = this.bb!.__offset(this.bb_pos, 36);
  return offset ? (obj || new DictVersion()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}

dictVersionsLength():number {
  const offset = this.bb!.__offset(this.bb_pos, 36);
  return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}

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

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

static startProfile(builder:flatbuffers.Builder) {
  builder.startObject(19);
}

static addUserId(builder:flatbuffers.Builder, userIdOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, userIdOffset, 0);
}

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

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

static addTimeZone(builder:flatbuffers.Builder, timeZoneOffset:flatbuffers.Offset) {
  builder.addFieldOffset(3, timeZoneOffset, 0);
}

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

static addBlockChat(builder:flatbuffers.Builder, blockChat:boolean) {
  builder.addFieldInt8(5, +blockChat, +false);
}

static addBlockFriendRequests(builder:flatbuffers.Builder, blockFriendRequests:boolean) {
  builder.addFieldInt8(6, +blockFriendRequests, +false);
}

static addIsGuest(builder:flatbuffers.Builder, isGuest:boolean) {
  builder.addFieldInt8(7, +isGuest, +false);
}

static addAwayStart(builder:flatbuffers.Builder, awayStartOffset:flatbuffers.Offset) {
  builder.addFieldOffset(8, awayStartOffset, 0);
}

static addAwayEnd(builder:flatbuffers.Builder, awayEndOffset:flatbuffers.Offset) {
  builder.addFieldOffset(9, awayEndOffset, 0);
}

static addNotificationsInAppOnly(builder:flatbuffers.Builder, notificationsInAppOnly:boolean) {
  builder.addFieldInt8(10, +notificationsInAppOnly, +true);
}

static addBanner(builder:flatbuffers.Builder, bannerOffset:flatbuffers.Offset) {
  builder.addFieldOffset(11, bannerOffset, 0);
}

static addVariantPreferences(builder:flatbuffers.Builder, variantPreferencesOffset:flatbuffers.Offset) {
  builder.addFieldOffset(12, variantPreferencesOffset, 0);
}

static createVariantPreferencesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
  builder.startVector(4, data.length, 4);
  for (let i = data.length - 1; i >= 0; i--) {
    builder.addOffset(data[i]!);
  }
  return builder.endVector();
}

static startVariantPreferencesVector(builder:flatbuffers.Builder, numElems:number) {
  builder.startVector(4, numElems, 4);
}

static addEmail(builder:flatbuffers.Builder, emailOffset:flatbuffers.Offset) {
  builder.addFieldOffset(13, emailOffset, 0);
}

static addTelegramLinked(builder:flatbuffers.Builder, telegramLinked:boolean) {
  builder.addFieldInt8(14, +telegramLinked, +false);
}

static addVkLinked(builder:flatbuffers.Builder, vkLinked:boolean) {
  builder.addFieldInt8(15, +vkLinked, +false);
}

static addDictVersions(builder:flatbuffers.Builder, dictVersionsOffset:flatbuffers.Offset) {
  builder.addFieldOffset(16, dictVersionsOffset, 0);
}

static createDictVersionsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
  builder.startVector(4, data.length, 4);
  for (let i = data.length - 1; i >= 0; i--) {
    builder.addOffset(data[i]!);
  }
  return builder.endVector();
}

static startDictVersionsVector(builder:flatbuffers.Builder, numElems:number) {
  builder.startVector(4, numElems, 4);
}

static addAds(builder:flatbuffers.Builder, adsOffset:flatbuffers.Offset) {
  builder.addFieldOffset(17, adsOffset, 0);
}

static addGameLimits(builder:flatbuffers.Builder, gameLimitsOffset:flatbuffers.Offset) {
  builder.addFieldOffset(18, gameLimitsOffset, 0);
}

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

}
