forked from firka/firka
add Institution model with JSON serialization
This commit is contained in:
89
firka/lib/helpers/api/model/institution.dart
Normal file
89
firka/lib/helpers/api/model/institution.dart
Normal 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']
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user