class FoodItem {
  final String id;
  final String kategori;
  final String nama;
  final String kuantitas;
  final String besaran;
  final String urt;
  final String energi;
  final String karbohidrat;
  final String protein;
  final String lemak;
  final String besi;
  final String vitamina;
  final String vitaminc;

  FoodItem({
    required this.id,
    required this.kategori,
    required this.nama,
    required this.kuantitas,
    required this.besaran,
    required this.urt,
    required this.energi,
    required this.karbohidrat,
    required this.protein,
    required this.lemak,
    required this.besi,
    required this.vitamina,
    required this.vitaminc,
  });

  factory FoodItem.fromJson(Map<String, dynamic> json) {
    return FoodItem(
      id: json['id_makanan'] ?? '',
      kategori: json['kategori'] ?? '',
      nama: json['nama_makanan'] ?? '',
      kuantitas: json['kuantitas'] ?? '',
      besaran: json['besaran'] ?? '',
      urt: json['urt'] ?? '',
      energi: json['energi'] ?? '',
      karbohidrat: json['karbohidrat'] ?? '',
      protein: json['protein'] ?? '',
      lemak: json['lemak'] ?? '',
      besi: json['besi'] ?? '',
      vitamina: json['vitamina'] ?? '',
      vitaminc: json['vitaminc'] ?? '',
    );
  }
}
