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.
133 lines
3.2 KiB
Dart
133 lines
3.2 KiB
Dart
class AlertZone {
|
|
int? zoneId;
|
|
String? zoneName;
|
|
|
|
AlertZone({this.zoneId, this.zoneName});
|
|
|
|
AlertZone.fromJson(Map<String, dynamic> json) {
|
|
zoneId = json['zoneId'];
|
|
zoneName = json['zoneName'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
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<AlertZone>? 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<String, dynamic> 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 = <AlertZone>[];
|
|
(json['zones'] as List).forEach((v) {
|
|
zones!.add(AlertZone.fromJson(v));
|
|
});
|
|
}
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
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";
|
|
}
|
|
|