2023-01-18 07:54:44 +00:00
|
|
|
class Module {
|
|
|
|
Module({
|
|
|
|
this.id,
|
|
|
|
this.icon,
|
|
|
|
this.name,
|
|
|
|
this.slug,
|
|
|
|
this.objects,
|
|
|
|
});
|
|
|
|
|
|
|
|
int? id;
|
|
|
|
String? icon;
|
|
|
|
String? name;
|
|
|
|
String? slug;
|
2023-07-28 02:21:42 +00:00
|
|
|
List<ModuleObject?>? objects;
|
2023-01-18 07:54:44 +00:00
|
|
|
|
|
|
|
factory Module.fromJson(Map<String, dynamic> json) => Module(
|
|
|
|
id: json["id"],
|
|
|
|
icon: json["icon"],
|
|
|
|
name: json["name"],
|
|
|
|
slug: json["slug"],
|
|
|
|
objects: json["objects"] == null
|
|
|
|
? []
|
2023-07-28 02:21:42 +00:00
|
|
|
: List<ModuleObject?>.from(
|
|
|
|
json["objects"]!.map((x) => ModuleObject.fromJson(x))),
|
2023-01-18 07:54:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"icon": icon,
|
|
|
|
"name": name,
|
|
|
|
"slug": slug,
|
|
|
|
"objects": objects == null
|
|
|
|
? []
|
|
|
|
: List<dynamic>.from(objects!.map((x) => x!.toJson())),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-07-28 02:21:42 +00:00
|
|
|
class ModuleObject {
|
|
|
|
ModuleObject({
|
2023-01-18 07:54:44 +00:00
|
|
|
this.id,
|
|
|
|
this.name,
|
|
|
|
this.slug,
|
|
|
|
this.operations,
|
|
|
|
});
|
|
|
|
|
|
|
|
int? id;
|
|
|
|
String? name;
|
|
|
|
String? slug;
|
|
|
|
List<String?>? operations;
|
|
|
|
|
2023-07-28 02:21:42 +00:00
|
|
|
factory ModuleObject.fromJson(Map<String, dynamic> json) => ModuleObject(
|
2023-01-18 07:54:44 +00:00
|
|
|
id: json["id"],
|
|
|
|
name: json["name"],
|
|
|
|
slug: json["slug"],
|
|
|
|
operations: json["operations"] == null
|
|
|
|
? []
|
|
|
|
: List<String?>.from(json["operations"]!.map((x) => x)),
|
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"name": name,
|
|
|
|
"slug": slug,
|
|
|
|
"operations": operations == null
|
|
|
|
? []
|
|
|
|
: List<dynamic>.from(operations!.map((x) => x)),
|
|
|
|
};
|
|
|
|
}
|