51 lines
1.1 KiB
Dart
51 lines
1.1 KiB
Dart
import 'package:dietary_guard/models/food_data.dart';
|
|
|
|
class AlertConfiguration {
|
|
String name;
|
|
int nutrientId;
|
|
double maxValue;
|
|
double minValue;
|
|
|
|
AlertConfiguration({
|
|
required this.name,
|
|
required this.nutrientId,
|
|
required this.maxValue,
|
|
required this.minValue,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'name': name,
|
|
'nutrient_id': nutrientId,
|
|
'min_value': minValue,
|
|
'max_value': maxValue,
|
|
};
|
|
|
|
factory AlertConfiguration.fromJson(Map<String, dynamic> json) =>
|
|
AlertConfiguration(
|
|
name: json['name'],
|
|
nutrientId: json['nutrient_id'],
|
|
minValue: json['min_value'],
|
|
maxValue: json['max_value'],
|
|
);
|
|
}
|
|
|
|
class AlertDetectResult {
|
|
AlertConfiguration config;
|
|
FoodNutrient? nutrient;
|
|
String name;
|
|
String? unitName;
|
|
double? difference;
|
|
bool isOutOfRange;
|
|
bool isUndetected;
|
|
|
|
AlertDetectResult({
|
|
required this.config,
|
|
required this.nutrient,
|
|
required this.name,
|
|
required this.unitName,
|
|
required this.difference,
|
|
required this.isOutOfRange,
|
|
required this.isUndetected,
|
|
});
|
|
}
|