DietaryGuard/lib/models/alert_configuration.dart

45 lines
968 B
Dart
Raw Normal View History

2024-08-15 03:53:01 +00:00
class AlertConfiguration {
int nutrientId;
double maxValue;
double minValue;
AlertConfiguration({
required this.nutrientId,
required this.maxValue,
required this.minValue,
});
Map<String, dynamic> toJson() => {
'nutrient_id': nutrientId,
'min_value': minValue,
'max_value': maxValue,
};
factory AlertConfiguration.fromJson(Map<String, dynamic> json) =>
AlertConfiguration(
nutrientId: json['nutrient_id'],
minValue: json['min_value'],
maxValue: json['max_value'],
);
}
2024-08-15 07:57:58 +00:00
class AlertDetectResult {
AlertConfiguration config;
String name;
String? unitName;
double? current;
double? difference;
bool isOutOfRange;
bool isUndetected;
AlertDetectResult({
required this.config,
required this.name,
required this.unitName,
required this.current,
required this.difference,
required this.isOutOfRange,
required this.isUndetected,
});
}