"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParamsT = exports.Params = 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 Params {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsParams(bb, obj) {
        return (obj || new Params()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsParams(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new Params()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    ssrc() {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
    }
    payloadType() {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
    }
    mimeType(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 8);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    clockRate() {
        const offset = this.bb.__offset(this.bb_pos, 10);
        return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
    }
    rrid(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 12);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    cname(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 14);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    static startParams(builder) {
        builder.startObject(6);
    }
    static addSsrc(builder, ssrc) {
        builder.addFieldInt32(0, ssrc, 0);
    }
    static addPayloadType(builder, payloadType) {
        builder.addFieldInt8(1, payloadType, 0);
    }
    static addMimeType(builder, mimeTypeOffset) {
        builder.addFieldOffset(2, mimeTypeOffset, 0);
    }
    static addClockRate(builder, clockRate) {
        builder.addFieldInt32(3, clockRate, 0);
    }
    static addRrid(builder, rridOffset) {
        builder.addFieldOffset(4, rridOffset, 0);
    }
    static addCname(builder, cnameOffset) {
        builder.addFieldOffset(5, cnameOffset, 0);
    }
    static endParams(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 8); // mime_type
        builder.requiredField(offset, 14); // cname
        return offset;
    }
    static createParams(builder, ssrc, payloadType, mimeTypeOffset, clockRate, rridOffset, cnameOffset) {
        Params.startParams(builder);
        Params.addSsrc(builder, ssrc);
        Params.addPayloadType(builder, payloadType);
        Params.addMimeType(builder, mimeTypeOffset);
        Params.addClockRate(builder, clockRate);
        Params.addRrid(builder, rridOffset);
        Params.addCname(builder, cnameOffset);
        return Params.endParams(builder);
    }
    unpack() {
        return new ParamsT(this.ssrc(), this.payloadType(), this.mimeType(), this.clockRate(), this.rrid(), this.cname());
    }
    unpackTo(_o) {
        _o.ssrc = this.ssrc();
        _o.payloadType = this.payloadType();
        _o.mimeType = this.mimeType();
        _o.clockRate = this.clockRate();
        _o.rrid = this.rrid();
        _o.cname = this.cname();
    }
}
exports.Params = Params;
class ParamsT {
    ssrc;
    payloadType;
    mimeType;
    clockRate;
    rrid;
    cname;
    constructor(ssrc = 0, payloadType = 0, mimeType = null, clockRate = 0, rrid = null, cname = null) {
        this.ssrc = ssrc;
        this.payloadType = payloadType;
        this.mimeType = mimeType;
        this.clockRate = clockRate;
        this.rrid = rrid;
        this.cname = cname;
    }
    pack(builder) {
        const mimeType = (this.mimeType !== null ? builder.createString(this.mimeType) : 0);
        const rrid = (this.rrid !== null ? builder.createString(this.rrid) : 0);
        const cname = (this.cname !== null ? builder.createString(this.cname) : 0);
        return Params.createParams(builder, this.ssrc, this.payloadType, mimeType, this.clockRate, rrid, cname);
    }
}
exports.ParamsT = ParamsT;
