34 lines
1.3 KiB
Dart
34 lines
1.3 KiB
Dart
import 'package:oc_front/models/abstract.dart';
|
|
import 'package:oc_front/models/resources/compute.dart';
|
|
import 'package:oc_front/models/resources/data.dart';
|
|
import 'package:oc_front/models/resources/processing.dart';
|
|
import 'package:oc_front/models/resources/storage.dart';
|
|
|
|
class Search extends SerializerDeserializer<Search> {
|
|
Search({
|
|
this.computing = const [],
|
|
this.compute = const [],
|
|
this.data = const [],
|
|
this.storage = const [],
|
|
});
|
|
List<ProcessingItem> computing;
|
|
List<ComputeItem> compute;
|
|
List<DataItem> data;
|
|
List<StorageItem> storage;
|
|
@override deserialize(dynamic json) {
|
|
json = json as Map<String, dynamic>;
|
|
return Search(
|
|
computing: json.containsKey("processing") ? fromListJson(json["processing"], ProcessingItem()) : [],
|
|
compute: json.containsKey("compute") ? fromListJson(json["compute"], ComputeItem()) : [],
|
|
data: json.containsKey("data") ? fromListJson(json["data"], DataItem()) : [],
|
|
storage: json.containsKey("storage") ? fromListJson(json["storage"], StorageItem()) : [],
|
|
);
|
|
}
|
|
@override Map<String, dynamic> serialize() => {
|
|
"processing": toListJson<ProcessingItem>(computing),
|
|
"compute": toListJson<ComputeItem>(compute),
|
|
"data": toListJson<DataItem>(data),
|
|
"storage": toListJson<StorageItem>(storage),
|
|
};
|
|
}
|