"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungOutputs = exports.KursblockungOutputs = void 0;
const JavaObject_1 = require("../../../java/lang/JavaObject");
const KursblockungOutput_1 = require("../../../core/data/kursblockung/KursblockungOutput");
const Vector_1 = require("../../../java/util/Vector");
class KursblockungOutputs extends JavaObject_1.JavaObject {
    blockungsRevision = -1;
    outputs = new Vector_1.Vector();
    constructor() {
        super();
    }
    isTranspiledInstanceOf(name) {
        return ['de.nrw.schule.svws.core.data.kursblockung.KursblockungOutputs'].includes(name);
    }
    static transpilerFromJSON(json) {
        const obj = JSON.parse(json);
        const result = new KursblockungOutputs();
        if (typeof obj.blockungsRevision === "undefined")
            throw new Error('invalid json format, missing attribute blockungsRevision');
        result.blockungsRevision = obj.blockungsRevision;
        if (!!obj.outputs) {
            for (let elem of obj.outputs) {
                result.outputs?.add(KursblockungOutput_1.KursblockungOutput.transpilerFromJSON(JSON.stringify(elem)));
            }
        }
        return result;
    }
    static transpilerToJSON(obj) {
        let result = '{';
        result += '"blockungsRevision" : ' + obj.blockungsRevision + ',';
        if (!obj.outputs) {
            result += '[]';
        }
        else {
            result += '[ ';
            for (let i = 0; i < obj.outputs.size(); i++) {
                let elem = obj.outputs.get(i);
                result += KursblockungOutput_1.KursblockungOutput.transpilerToJSON(elem);
                if (i < obj.outputs.size() - 1)
                    result += ',';
            }
            result += ' ]' + ',';
        }
        result = result.slice(0, -1);
        result += '}';
        return result;
    }
    static transpilerToJSONPatch(obj) {
        let result = '{';
        if (typeof obj.blockungsRevision !== "undefined") {
            result += '"blockungsRevision" : ' + obj.blockungsRevision + ',';
        }
        if (typeof obj.outputs !== "undefined") {
            if (!obj.outputs) {
                result += '[]';
            }
            else {
                result += '[ ';
                for (let i = 0; i < obj.outputs.size(); i++) {
                    let elem = obj.outputs.get(i);
                    result += KursblockungOutput_1.KursblockungOutput.transpilerToJSON(elem);
                    if (i < obj.outputs.size() - 1)
                        result += ',';
                }
                result += ' ]' + ',';
            }
        }
        result = result.slice(0, -1);
        result += '}';
        return result;
    }
}
exports.KursblockungOutputs = KursblockungOutputs;
function cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungOutputs(obj) {
    return obj;
}
exports.cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungOutputs = cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungOutputs;
//# sourceMappingURL=KursblockungOutputs.js.map