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