"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class RTCRtpEncodingParameters {
    constructor(init) {
        var _a, _b, _c, _d;
        this.active = init.active;
        this._rid = (_a = init.rid) !== null && _a !== void 0 ? _a : null;
        this._maxBitrate = (_b = init.maxBitrate) !== null && _b !== void 0 ? _b : null;
        this._maxFramerate = (_c = init.maxFramerate) !== null && _c !== void 0 ? _c : null;
        this._scaleResolutionDownBy = (_d = init.scaleResolutionDownBy) !== null && _d !== void 0 ? _d : null;
    }
    get rid() {
        return this._rid;
    }
    get maxFramerate() {
        return this._maxFramerate;
    }
    set maxFramerate(framerate) {
        // eslint-disable-next-line eqeqeq
        if (framerate != null && framerate > 0) {
            this._maxFramerate = framerate;
        }
        else {
            this._maxFramerate = null;
        }
    }
    get maxBitrate() {
        return this._maxBitrate;
    }
    set maxBitrate(bitrate) {
        // eslint-disable-next-line eqeqeq
        if (bitrate != null && bitrate >= 0) {
            this._maxBitrate = bitrate;
        }
        else {
            this._maxBitrate = null;
        }
    }
    get scaleResolutionDownBy() {
        return this._scaleResolutionDownBy;
    }
    set scaleResolutionDownBy(resolutionScale) {
        // eslint-disable-next-line eqeqeq
        if (resolutionScale != null && resolutionScale >= 1) {
            this._scaleResolutionDownBy = resolutionScale;
        }
        else {
            this._scaleResolutionDownBy = null;
        }
    }
    toJSON() {
        const obj = {
            active: this.active,
        };
        if (this._rid !== null) {
            obj['rid'] = this._rid;
        }
        if (this._maxBitrate !== null) {
            obj['maxBitrate'] = this._maxBitrate;
        }
        if (this._maxFramerate !== null) {
            obj['maxFramerate'] = this._maxFramerate;
        }
        if (this._scaleResolutionDownBy !== null) {
            obj['scaleResolutionDownBy'] = this._scaleResolutionDownBy;
        }
        return obj;
    }
}
exports.default = RTCRtpEncodingParameters;
//# sourceMappingURL=RTCRtpEncodingParameters.js.map