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

import * as flatbuffers from 'flatbuffers';

import { BannerCampaign } from '../scrabblefb/banner-campaign.js';


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

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

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

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

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

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

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

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

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

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

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

static startBannerInfo(builder:flatbuffers.Builder) {
  builder.startObject(7);
}

static addCampaigns(builder:flatbuffers.Builder, campaignsOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, campaignsOffset, 0);
}

static createCampaignsVector(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 startCampaignsVector(builder:flatbuffers.Builder, numElems:number) {
  builder.startVector(4, numElems, 4);
}

static addHoldMs(builder:flatbuffers.Builder, holdMs:number) {
  builder.addFieldInt32(1, holdMs, 0);
}

static addEdgePauseMs(builder:flatbuffers.Builder, edgePauseMs:number) {
  builder.addFieldInt32(2, edgePauseMs, 0);
}

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

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

static addGapMs(builder:flatbuffers.Builder, gapMs:number) {
  builder.addFieldInt32(5, gapMs, 0);
}

static addFadeInMs(builder:flatbuffers.Builder, fadeInMs:number) {
  builder.addFieldInt32(6, fadeInMs, 0);
}

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

static createBannerInfo(builder:flatbuffers.Builder, campaignsOffset:flatbuffers.Offset, holdMs:number, edgePauseMs:number, scrollPxPerSec:number, fadeOutMs:number, gapMs:number, fadeInMs:number):flatbuffers.Offset {
  BannerInfo.startBannerInfo(builder);
  BannerInfo.addCampaigns(builder, campaignsOffset);
  BannerInfo.addHoldMs(builder, holdMs);
  BannerInfo.addEdgePauseMs(builder, edgePauseMs);
  BannerInfo.addScrollPxPerSec(builder, scrollPxPerSec);
  BannerInfo.addFadeOutMs(builder, fadeOutMs);
  BannerInfo.addGapMs(builder, gapMs);
  BannerInfo.addFadeInMs(builder, fadeInMs);
  return BannerInfo.endBannerInfo(builder);
}
}
