class Product { final int id; final String name; final String category; final int price; final int stock; final String status; // 'tersedia', 'rendah', 'kritis' Product({ required this.id, required this.name, required this.category, required this.price, required this.stock, this.status = 'tersedia', }); factory Product.fromJson(Map json) { return Product( id: json['id'] as int, name: json['name'] as String, category: json['category'] as String, price: json['price'] as int, stock: json['stock'] as int, status: json['status'] as String? ?? 'tersedia', ); } Map toJson() { return { 'id': id, 'name': name, 'category': category, 'price': price, 'stock': stock, 'status': status, }; } Product copyWith({ int? id, String? name, String? category, int? price, int? stock, String? status, }) { return Product( id: id ?? this.id, name: name ?? this.name, category: category ?? this.category, price: price ?? this.price, stock: stock ?? this.stock, status: status ?? this.status, ); } @override String toString() => 'Product(id: $id, name: $name, stock: $stock)'; }