"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInput = exports.KursblockungInput = void 0;
const JavaObject_1 = require("../../../java/lang/JavaObject");
const KursblockungInputKurs_1 = require("../../../core/data/kursblockung/KursblockungInputKurs");
const KursblockungInputSchueler_1 = require("../../../core/data/kursblockung/KursblockungInputSchueler");
const KursblockungInputRegel_1 = require("../../../core/data/kursblockung/KursblockungInputRegel");
const KursblockungInputKursart_1 = require("../../../core/data/kursblockung/KursblockungInputKursart");
const KursblockungInputFach_1 = require("../../../core/data/kursblockung/KursblockungInputFach");
const KursblockungInputFachwahl_1 = require("../../../core/data/kursblockung/KursblockungInputFachwahl");
const Vector_1 = require("../../../java/util/Vector");
class KursblockungInput extends JavaObject_1.JavaObject {
    enmRevision = -1;
    input = 0;
    maxTimeMillis = 0;
    maxSchienen = 0;
    regeln = new Vector_1.Vector();
    faecher = new Vector_1.Vector();
    kursarten = new Vector_1.Vector();
    kurse = new Vector_1.Vector();
    schueler = new Vector_1.Vector();
    fachwahlen = new Vector_1.Vector();
    constructor() {
        super();
    }
    isTranspiledInstanceOf(name) {
        return ['de.nrw.schule.svws.core.data.kursblockung.KursblockungInput'].includes(name);
    }
    static transpilerFromJSON(json) {
        const obj = JSON.parse(json);
        const result = new KursblockungInput();
        if (typeof obj.enmRevision === "undefined")
            throw new Error('invalid json format, missing attribute enmRevision');
        result.enmRevision = obj.enmRevision;
        if (typeof obj.input === "undefined")
            throw new Error('invalid json format, missing attribute input');
        result.input = obj.input;
        if (typeof obj.maxTimeMillis === "undefined")
            throw new Error('invalid json format, missing attribute maxTimeMillis');
        result.maxTimeMillis = obj.maxTimeMillis;
        if (typeof obj.maxSchienen === "undefined")
            throw new Error('invalid json format, missing attribute maxSchienen');
        result.maxSchienen = obj.maxSchienen;
        if (!!obj.regeln) {
            for (let elem of obj.regeln) {
                result.regeln?.add(KursblockungInputRegel_1.KursblockungInputRegel.transpilerFromJSON(JSON.stringify(elem)));
            }
        }
        if (!!obj.faecher) {
            for (let elem of obj.faecher) {
                result.faecher?.add(KursblockungInputFach_1.KursblockungInputFach.transpilerFromJSON(JSON.stringify(elem)));
            }
        }
        if (!!obj.kursarten) {
            for (let elem of obj.kursarten) {
                result.kursarten?.add(KursblockungInputKursart_1.KursblockungInputKursart.transpilerFromJSON(JSON.stringify(elem)));
            }
        }
        if (!!obj.kurse) {
            for (let elem of obj.kurse) {
                result.kurse?.add(KursblockungInputKurs_1.KursblockungInputKurs.transpilerFromJSON(JSON.stringify(elem)));
            }
        }
        if (!!obj.schueler) {
            for (let elem of obj.schueler) {
                result.schueler?.add(KursblockungInputSchueler_1.KursblockungInputSchueler.transpilerFromJSON(JSON.stringify(elem)));
            }
        }
        if (!!obj.fachwahlen) {
            for (let elem of obj.fachwahlen) {
                result.fachwahlen?.add(KursblockungInputFachwahl_1.KursblockungInputFachwahl.transpilerFromJSON(JSON.stringify(elem)));
            }
        }
        return result;
    }
    static transpilerToJSON(obj) {
        let result = '{';
        result += '"enmRevision" : ' + obj.enmRevision + ',';
        result += '"input" : ' + obj.input + ',';
        result += '"maxTimeMillis" : ' + obj.maxTimeMillis + ',';
        result += '"maxSchienen" : ' + obj.maxSchienen + ',';
        if (!obj.regeln) {
            result += '[]';
        }
        else {
            result += '[ ';
            for (let i = 0; i < obj.regeln.size(); i++) {
                let elem = obj.regeln.get(i);
                result += KursblockungInputRegel_1.KursblockungInputRegel.transpilerToJSON(elem);
                if (i < obj.regeln.size() - 1)
                    result += ',';
            }
            result += ' ]' + ',';
        }
        if (!obj.faecher) {
            result += '[]';
        }
        else {
            result += '[ ';
            for (let i = 0; i < obj.faecher.size(); i++) {
                let elem = obj.faecher.get(i);
                result += KursblockungInputFach_1.KursblockungInputFach.transpilerToJSON(elem);
                if (i < obj.faecher.size() - 1)
                    result += ',';
            }
            result += ' ]' + ',';
        }
        if (!obj.kursarten) {
            result += '[]';
        }
        else {
            result += '[ ';
            for (let i = 0; i < obj.kursarten.size(); i++) {
                let elem = obj.kursarten.get(i);
                result += KursblockungInputKursart_1.KursblockungInputKursart.transpilerToJSON(elem);
                if (i < obj.kursarten.size() - 1)
                    result += ',';
            }
            result += ' ]' + ',';
        }
        if (!obj.kurse) {
            result += '[]';
        }
        else {
            result += '[ ';
            for (let i = 0; i < obj.kurse.size(); i++) {
                let elem = obj.kurse.get(i);
                result += KursblockungInputKurs_1.KursblockungInputKurs.transpilerToJSON(elem);
                if (i < obj.kurse.size() - 1)
                    result += ',';
            }
            result += ' ]' + ',';
        }
        if (!obj.schueler) {
            result += '[]';
        }
        else {
            result += '[ ';
            for (let i = 0; i < obj.schueler.size(); i++) {
                let elem = obj.schueler.get(i);
                result += KursblockungInputSchueler_1.KursblockungInputSchueler.transpilerToJSON(elem);
                if (i < obj.schueler.size() - 1)
                    result += ',';
            }
            result += ' ]' + ',';
        }
        if (!obj.fachwahlen) {
            result += '[]';
        }
        else {
            result += '[ ';
            for (let i = 0; i < obj.fachwahlen.size(); i++) {
                let elem = obj.fachwahlen.get(i);
                result += KursblockungInputFachwahl_1.KursblockungInputFachwahl.transpilerToJSON(elem);
                if (i < obj.fachwahlen.size() - 1)
                    result += ',';
            }
            result += ' ]' + ',';
        }
        result = result.slice(0, -1);
        result += '}';
        return result;
    }
    static transpilerToJSONPatch(obj) {
        let result = '{';
        if (typeof obj.enmRevision !== "undefined") {
            result += '"enmRevision" : ' + obj.enmRevision + ',';
        }
        if (typeof obj.input !== "undefined") {
            result += '"input" : ' + obj.input + ',';
        }
        if (typeof obj.maxTimeMillis !== "undefined") {
            result += '"maxTimeMillis" : ' + obj.maxTimeMillis + ',';
        }
        if (typeof obj.maxSchienen !== "undefined") {
            result += '"maxSchienen" : ' + obj.maxSchienen + ',';
        }
        if (typeof obj.regeln !== "undefined") {
            if (!obj.regeln) {
                result += '[]';
            }
            else {
                result += '[ ';
                for (let i = 0; i < obj.regeln.size(); i++) {
                    let elem = obj.regeln.get(i);
                    result += KursblockungInputRegel_1.KursblockungInputRegel.transpilerToJSON(elem);
                    if (i < obj.regeln.size() - 1)
                        result += ',';
                }
                result += ' ]' + ',';
            }
        }
        if (typeof obj.faecher !== "undefined") {
            if (!obj.faecher) {
                result += '[]';
            }
            else {
                result += '[ ';
                for (let i = 0; i < obj.faecher.size(); i++) {
                    let elem = obj.faecher.get(i);
                    result += KursblockungInputFach_1.KursblockungInputFach.transpilerToJSON(elem);
                    if (i < obj.faecher.size() - 1)
                        result += ',';
                }
                result += ' ]' + ',';
            }
        }
        if (typeof obj.kursarten !== "undefined") {
            if (!obj.kursarten) {
                result += '[]';
            }
            else {
                result += '[ ';
                for (let i = 0; i < obj.kursarten.size(); i++) {
                    let elem = obj.kursarten.get(i);
                    result += KursblockungInputKursart_1.KursblockungInputKursart.transpilerToJSON(elem);
                    if (i < obj.kursarten.size() - 1)
                        result += ',';
                }
                result += ' ]' + ',';
            }
        }
        if (typeof obj.kurse !== "undefined") {
            if (!obj.kurse) {
                result += '[]';
            }
            else {
                result += '[ ';
                for (let i = 0; i < obj.kurse.size(); i++) {
                    let elem = obj.kurse.get(i);
                    result += KursblockungInputKurs_1.KursblockungInputKurs.transpilerToJSON(elem);
                    if (i < obj.kurse.size() - 1)
                        result += ',';
                }
                result += ' ]' + ',';
            }
        }
        if (typeof obj.schueler !== "undefined") {
            if (!obj.schueler) {
                result += '[]';
            }
            else {
                result += '[ ';
                for (let i = 0; i < obj.schueler.size(); i++) {
                    let elem = obj.schueler.get(i);
                    result += KursblockungInputSchueler_1.KursblockungInputSchueler.transpilerToJSON(elem);
                    if (i < obj.schueler.size() - 1)
                        result += ',';
                }
                result += ' ]' + ',';
            }
        }
        if (typeof obj.fachwahlen !== "undefined") {
            if (!obj.fachwahlen) {
                result += '[]';
            }
            else {
                result += '[ ';
                for (let i = 0; i < obj.fachwahlen.size(); i++) {
                    let elem = obj.fachwahlen.get(i);
                    result += KursblockungInputFachwahl_1.KursblockungInputFachwahl.transpilerToJSON(elem);
                    if (i < obj.fachwahlen.size() - 1)
                        result += ',';
                }
                result += ' ]' + ',';
            }
        }
        result = result.slice(0, -1);
        result += '}';
        return result;
    }
}
exports.KursblockungInput = KursblockungInput;
function cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInput(obj) {
    return obj;
}
exports.cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInput = cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInput;
//# sourceMappingURL=KursblockungInput.js.map