class Product { final String id; final String name; final String category; final int stockQuantity; final int lowStockThreshold; final int priceInCents; final String? imagePath; final bool active; const Product({ required this.id, required this.name, required this.category, required this.stockQuantity, required this.lowStockThreshold, required this.priceInCents, this.imagePath, this.active = true, }); bool get isLowStock => stockQuantity <= lowStockThreshold; String get formattedPrice { final euros = priceInCents / 100; return '€${euros.toStringAsFixed(2)}'; } Product copyWith({ String? id, String? name, String? category, int? stockQuantity, int? lowStockThreshold, int? priceInCents, String? imagePath, bool? active, }) { return Product( id: id ?? this.id, name: name ?? this.name, category: category ?? this.category, stockQuantity: stockQuantity ?? this.stockQuantity, lowStockThreshold: lowStockThreshold ?? this.lowStockThreshold, priceInCents: priceInCents ?? this.priceInCents, imagePath: imagePath ?? this.imagePath, active: active ?? this.active, ); } @override bool operator ==(Object other) => identical(this, other) || other is Product && id == other.id && name == other.name && category == other.category && stockQuantity == other.stockQuantity && lowStockThreshold == other.lowStockThreshold && priceInCents == other.priceInCents && imagePath == other.imagePath && active == other.active; @override int get hashCode => Object.hash( id, name, category, stockQuantity, lowStockThreshold, priceInCents, imagePath, active, ); }