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