class GroceryItem {
  final int id;
  final String name;
  final String quantity;
  final String emoji;
  bool inCart;

  GroceryItem({
    required this.id,
    required this.name,
    required this.quantity,
    required this.emoji,
    this.inCart = false,
  });

  factory GroceryItem.fromJson(int id, Map<String, dynamic> json) {
    return GroceryItem(
      id: id,
      name: json['name'] ?? '',
      quantity: json['quantity'] ?? '',
      emoji: json['emoji'] ?? '🛒',
    );
  }
}