import { JavaObject, cast_java_lang_Object } from '../../../java/lang/JavaObject';
import { JavaLong, cast_java_lang_Long } from '../../../java/lang/JavaLong';

export class KursblockungInputRegel extends JavaObject {

	public enmRevision : number = -1;

	public id : number = 0;

	public daten : Array<Number> = Array(0).fill(null);


	public constructor() {
		super();
	}

	isTranspiledInstanceOf(name : string): boolean {
		return ['de.nrw.schule.svws.core.data.kursblockung.KursblockungInputRegel'].includes(name);
	}

	public static transpilerFromJSON(json : string): KursblockungInputRegel {
		const obj = JSON.parse(json);
		const result = new KursblockungInputRegel();
		if (typeof obj.enmRevision === "undefined")
			 throw new Error('invalid json format, missing attribute enmRevision');
		result.enmRevision = obj.enmRevision;
		if (typeof obj.id === "undefined")
			 throw new Error('invalid json format, missing attribute id');
		result.id = obj.id;
		for (let i : number = 0; i < obj.daten.length; i++) {
			result.daten[i] = obj.daten[i];
		}
		return result;
	}

	public static transpilerToJSON(obj : KursblockungInputRegel) : string {
		let result = '{';
		result += '"enmRevision" : ' + obj.enmRevision + ',';
		result += '"id" : ' + obj.id + ',';
		if (!obj.daten) {
			result += '[]';
		} else {
			result += '[ ';
			for (let i : number = 0; i < obj.daten.length; i++) {
				let elem = obj.daten[i];
				result += elem;
				if (i < obj.daten.length - 1)
					result += ',';
			}
			result += ' ]' + ',';
		}
		result = result.slice(0, -1);
		result += '}';
		return result;
	}

	public static transpilerToJSONPatch(obj : Partial<KursblockungInputRegel>) : string {
		let result = '{';
		if (typeof obj.enmRevision !== "undefined") {
			result += '"enmRevision" : ' + obj.enmRevision + ',';
		}
		if (typeof obj.id !== "undefined") {
			result += '"id" : ' + obj.id + ',';
		}
		if (typeof obj.daten !== "undefined") {
			let a = obj.daten;
			if (!a) {
				result += '[]';
			} else {
				result += '[ ';
				for (let i : number = 0; i < a.length; i++) {
					let elem = a[i];
					result += elem;
					if (i < a.length - 1)
						result += ',';
				}
				result += ' ]' + ',';
			}
		}
		result = result.slice(0, -1);
		result += '}';
		return result;
	}

}

export function cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInputRegel(obj : unknown) : KursblockungInputRegel {
	return obj as KursblockungInputRegel;
}
