class Product { final String id; final String name; final String description; final double price; final int stock; final String category; final List images; final String sellerId; final bool isActive; final DateTime createdAt; Product({ required this.id, required this.name, required this.description, required this.price, required this.stock, required this.category, required this.images, required this.sellerId, this.isActive = true, required this.createdAt, }); factory Product.fromJson(Map json) { return Product( id: json['id'], name: json['name'], description: json['description'], price: json['price'].toDouble(), stock: json['stock'], category: json['category'], images: List.from(json['images']), sellerId: json['seller_id'], isActive: json['is_active'] ?? true, createdAt: DateTime.parse(json['created_at']), ); } Map toJson() { return { 'id': id, 'name': name, 'description': description, 'price': price, 'stock': stock, 'category': category, 'images': images, 'seller_id': sellerId, 'is_active': isActive, 'created_at': createdAt.toIso8601String(), }; } }