class AlertZone { int? zoneId; String? zoneName; AlertZone({this.zoneId, this.zoneName}); AlertZone.fromJson(Map json) { zoneId = json['zoneId']; zoneName = json['zoneName']; } Map toJson() { final Map data = {}; data['zoneId'] = zoneId; data['zoneName'] = zoneName; return data; } } class AlertModel { int? id; int? ruleId; String? alertId; String? ruleName; String? ruleTriggerType; String? severity; String? dateTime; bool? resolved; bool? enter; int? entityId; int? campusId; String? campusName; int? venueId; String? venueName; int? floorId; String? floorName; List? zones; int? geofenceId; dynamic idleThreshold; dynamic count; dynamic externalJson; String? createdDate; AlertModel({ this.id, this.ruleId, this.alertId, this.ruleName, this.ruleTriggerType, this.severity, this.dateTime, this.resolved, this.enter, this.entityId, this.campusId, this.campusName, this.venueId, this.venueName, this.floorId, this.floorName, this.zones, this.geofenceId, this.idleThreshold, this.count, this.externalJson, this.createdDate, }); AlertModel.fromJson(Map json) { id = json['id']; ruleId = json['ruleId']; alertId = json['alertId']; ruleName = json['ruleName']; ruleTriggerType = json['ruleTriggerType']; severity = json['severity']; dateTime = json['dateTime']; resolved = json['resolved']; enter = json['enter']; entityId = json['entityId']; campusId = json['campusId']; campusName = json['campusName']; venueId = json['venueId']; venueName = json['venueName']; floorId = json['floorId']; floorName = json['floorName']; geofenceId = json['geofenceId']; idleThreshold = json['idleThreshold']; count = json['count']; externalJson = json['externalJson']; createdDate = json['createdDate']; if (json['zones'] != null) { zones = []; (json['zones'] as List).forEach((v) { zones!.add(AlertZone.fromJson(v)); }); } } Map toJson() { final Map data = {}; data['id'] = id; data['ruleId'] = ruleId; data['alertId'] = alertId; data['ruleName'] = ruleName; data['ruleTriggerType'] = ruleTriggerType; data['severity'] = severity; data['dateTime'] = dateTime; data['resolved'] = resolved; data['enter'] = enter; data['entityId'] = entityId; data['campusId'] = campusId; data['campusName'] = campusName; data['venueId'] = venueId; data['venueName'] = venueName; data['floorId'] = floorId; data['floorName'] = floorName; data['geofenceId'] = geofenceId; data['idleThreshold'] = idleThreshold; data['count'] = count; data['externalJson'] = externalJson; data['createdDate'] = createdDate; if (zones != null) { data['zones'] = zones!.map((v) => v.toJson()).toList(); } return data; } bool get isResolved => resolved == true; String get statusLabel => isResolved ? "Resolved" : "Open"; }