refactor: remove unused parser files and update ParsedReceiptItem model with additional fields

This commit is contained in:
Nils-Johan Gynther
2026-05-01 01:16:10 +02:00
parent 879501292d
commit bfe9cb46fa
9 changed files with 26 additions and 854 deletions
@@ -3,25 +3,43 @@ class ParsedReceiptItem {
final String rawName;
final double? quantity;
final String? unit;
final String? suggestedProductId;
final double? price;
final String? brand;
final String? origin;
// alias-match (säker, ingen bekräftelse behövs)
final int? matchedProductId;
final String? matchedProductName;
// ordbaserad match (kräver bekräftelse)
final int? suggestedProductId;
final String? suggestedProductName;
final String? categorySuggestion;
// AI-kategorisuggestion (premium)
final String? categorySuggestionName;
ParsedReceiptItem({
required this.rawName,
this.quantity,
this.unit,
this.price,
this.brand,
this.origin,
this.matchedProductId,
this.matchedProductName,
this.suggestedProductId,
this.suggestedProductName,
this.categorySuggestion,
this.categorySuggestionName,
});
factory ParsedReceiptItem.fromJson(Map<String, dynamic> json) => ParsedReceiptItem(
rawName: json['rawName'] as String,
rawName: json['rawName'] as String? ?? '',
quantity: (json['quantity'] as num?)?.toDouble(),
unit: json['unit'] as String?,
suggestedProductId: json['suggestedProductId'] as String?,
price: (json['price'] as num?)?.toDouble(),
brand: json['brand'] as String?,
origin: json['origin'] as String?,
matchedProductId: (json['matchedProductId'] as num?)?.toInt(),
matchedProductName: json['matchedProductName'] as String?,
suggestedProductId: (json['suggestedProductId'] as num?)?.toInt(),
suggestedProductName: json['suggestedProductName'] as String?,
categorySuggestion: json['categorySuggestion'] as String?,
categorySuggestionName: (json['categorySuggestion'] as Map<String, dynamic>?)?['categoryName'] as String?,
);
}