You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/modules/asset_tracking/models/zone_data_model.dart

87 lines
2.1 KiB
Dart

import 'coordinates_model.dart';
class ZoneModel {
int? id;
String? referenceId;
String? name;
ZoneType? zoneType;
Location? location;
List<Coordinates>? coordinates;
ZoneModel({this.id, this.referenceId, this.name, this.zoneType, this.location, this.coordinates});
ZoneModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
referenceId = json['referenceId'];
name = json['name'];
zoneType = json['zoneType'] != null ? new ZoneType.fromJson(json['zoneType']) : null;
location = json['location'] != null ? new Location.fromJson(json['location']) : null;
if (json['coordinates'] != null) {
coordinates = <Coordinates>[];
json['coordinates'].forEach((v) {
coordinates!.add(new Coordinates.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['referenceId'] = this.referenceId;
data['name'] = this.name;
if (this.zoneType != null) {
data['zoneType'] = this.zoneType!.toJson();
}
if (this.location != null) {
data['location'] = this.location!.toJson();
}
if (this.coordinates != null) {
data['coordinates'] = this.coordinates!.map((v) => v.toJson()).toList();
}
return data;
}
}
class ZoneType {
int? id;
String? name;
ZoneType({this.id, this.name});
ZoneType.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
class Location {
int? id;
String? name;
String? label;
Location({this.id, this.name, this.label});
Location.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
label = json['label'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['label'] = this.label;
return data;
}
}