"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScoreT = exports.Score = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = require("flatbuffers");
class Score {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsScore(bb, obj) {
        return (obj || new Score()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsScore(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new Score()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    encodingIdx() {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
    }
    ssrc() {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
    }
    rid(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 8);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    score() {
        const offset = this.bb.__offset(this.bb_pos, 10);
        return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
    }
    static startScore(builder) {
        builder.startObject(4);
    }
    static addEncodingIdx(builder, encodingIdx) {
        builder.addFieldInt32(0, encodingIdx, 0);
    }
    static addSsrc(builder, ssrc) {
        builder.addFieldInt32(1, ssrc, 0);
    }
    static addRid(builder, ridOffset) {
        builder.addFieldOffset(2, ridOffset, 0);
    }
    static addScore(builder, score) {
        builder.addFieldInt8(3, score, 0);
    }
    static endScore(builder) {
        const offset = builder.endObject();
        return offset;
    }
    static createScore(builder, encodingIdx, ssrc, ridOffset, score) {
        Score.startScore(builder);
        Score.addEncodingIdx(builder, encodingIdx);
        Score.addSsrc(builder, ssrc);
        Score.addRid(builder, ridOffset);
        Score.addScore(builder, score);
        return Score.endScore(builder);
    }
    unpack() {
        return new ScoreT(this.encodingIdx(), this.ssrc(), this.rid(), this.score());
    }
    unpackTo(_o) {
        _o.encodingIdx = this.encodingIdx();
        _o.ssrc = this.ssrc();
        _o.rid = this.rid();
        _o.score = this.score();
    }
}
exports.Score = Score;
class ScoreT {
    encodingIdx;
    ssrc;
    rid;
    score;
    constructor(encodingIdx = 0, ssrc = 0, rid = null, score = 0) {
        this.encodingIdx = encodingIdx;
        this.ssrc = ssrc;
        this.rid = rid;
        this.score = score;
    }
    pack(builder) {
        const rid = (this.rid !== null ? builder.createString(this.rid) : 0);
        return Score.createScore(builder, this.encodingIdx, this.ssrc, rid, this.score);
    }
}
exports.ScoreT = ScoreT;
