1
0
forked from firka/firka

add Institution model with JSON serialization

This commit is contained in:
zypherift
2025-03-12 21:34:16 +01:00
parent 0a32eaf5d7
commit 577f3d0173

View File

@@ -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 <https://www.gnu.org/licenses/>.
*/
class Institution {
final CustomizationSettings customizationSettings;
final String shortName;
final List<SystemModule> systemModuleList;
final String uid;
Institution({
required this.customizationSettings,
required this.shortName,
required this.systemModuleList,
required this.uid
});
factory Institution.fromJson(Map<String, dynamic> 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<String, dynamic> 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<String, dynamic> json) {
return SystemModule(
isActive: json['IsAktiv'],
type: json['Tipus'],
url: json['Url']
);
}
}