From 577f3d0173c3aad0e49c5abd37262f1354ea4079 Mon Sep 17 00:00:00 2001 From: zypherift Date: Wed, 12 Mar 2025 21:34:16 +0100 Subject: [PATCH] add Institution model with JSON serialization --- firka/lib/helpers/api/model/institution.dart | 89 ++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 firka/lib/helpers/api/model/institution.dart diff --git a/firka/lib/helpers/api/model/institution.dart b/firka/lib/helpers/api/model/institution.dart new file mode 100644 index 00000000..86494ac1 --- /dev/null +++ b/firka/lib/helpers/api/model/institution.dart @@ -0,0 +1,89 @@ +/* + Firka, alternative e-Kréta client. + Copyright (C) 2025 QwIT Development + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +class Institution { + + final CustomizationSettings customizationSettings; + final String shortName; + final List systemModuleList; + final String uid; + + Institution({ + required this.customizationSettings, + required this.shortName, + required this.systemModuleList, + required this.uid + }); + + factory Institution.fromJson(Map json) { + return Institution( + customizationSettings: json['TestreszabasBeallitasok'], + shortName: json['RovidNev'], + systemModuleList: json['Rendszermodulok'], + uid: json['Uid'], + ); + } + +} + +class CustomizationSettings { + + final int delayForNotifications; + final bool isClassAverageVisible; + final bool isLessonsThemeVisible; + final String nextServerDeployAsString; + + CustomizationSettings({ + required this.delayForNotifications, + required this.isClassAverageVisible, + required this.isLessonsThemeVisible, + required this.nextServerDeployAsString + }); + + factory CustomizationSettings.fromJson(Map json) { + return CustomizationSettings( + delayForNotifications: json['ErtekelesekMegjelenitesenekKesleltetesenekMerteke'], + isClassAverageVisible: json['IsOsztalyAtlagMegjeleniteseEllenorzoben'], + isLessonsThemeVisible: json['IsTanorakTemajaMegtekinthetoEllenorzoben'], + nextServerDeployAsString: json['KovetkezoTelepitesDatuma'] + ); + } + +} + +class SystemModule { + + final bool isActive; + final String type; + final String url; + + SystemModule({ + required this.isActive, + required this.type, + required this.url + }); + + factory SystemModule.fromJson(Map json) { + return SystemModule( + isActive: json['IsAktiv'], + type: json['Tipus'], + url: json['Url'] + ); + } + +} \ No newline at end of file