import 'coordinates_model.dart'; class ZoneModel { int? id; String? referenceId; String? name; ZoneType? zoneType; Location? location; List? coordinates; ZoneModel({this.id, this.referenceId, this.name, this.zoneType, this.location, this.coordinates}); ZoneModel.fromJson(Map 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 = []; json['coordinates'].forEach((v) { coordinates!.add(new Coordinates.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); 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 json) { id = json['id']; name = json['name']; } Map toJson() { final Map data = new Map(); 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 json) { id = json['id']; name = json['name']; label = json['label']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; data['label'] = this.label; return data; } }