"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScoreNotificationT = exports.ScoreNotification = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = require("flatbuffers");
const consumer_score_1 = require("../../fbs/consumer/consumer-score");
class ScoreNotification {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsScoreNotification(bb, obj) {
        return (obj || new ScoreNotification()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsScoreNotification(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new ScoreNotification()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    score(obj) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? (obj || new consumer_score_1.ConsumerScore()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    static startScoreNotification(builder) {
        builder.startObject(1);
    }
    static addScore(builder, scoreOffset) {
        builder.addFieldOffset(0, scoreOffset, 0);
    }
    static endScoreNotification(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // score
        return offset;
    }
    static createScoreNotification(builder, scoreOffset) {
        ScoreNotification.startScoreNotification(builder);
        ScoreNotification.addScore(builder, scoreOffset);
        return ScoreNotification.endScoreNotification(builder);
    }
    unpack() {
        return new ScoreNotificationT((this.score() !== null ? this.score().unpack() : null));
    }
    unpackTo(_o) {
        _o.score = (this.score() !== null ? this.score().unpack() : null);
    }
}
exports.ScoreNotification = ScoreNotification;
class ScoreNotificationT {
    score;
    constructor(score = null) {
        this.score = score;
    }
    pack(builder) {
        const score = (this.score !== null ? this.score.pack(builder) : 0);
        return ScoreNotification.createScoreNotification(builder, score);
    }
}
exports.ScoreNotificationT = ScoreNotificationT;
