class PlansModel {
  final String id;
  final String status;
  final String apartment;
  final String liters;
  final String price;
  final String advance;
  final String deliveries;
  final String frequency;
  final String waterType;

  PlansModel({
    required this.id,
    required this.status,
    required this.apartment,
    required this.liters,
    required this.price,
    required this.advance,
    required this.deliveries,
    required this.frequency,
    required this.waterType,
  });

  factory PlansModel.fromJson(Map<String, dynamic> json) {
    final supplier = json["my_supplier"] ?? {};

    return PlansModel(
      id: json["_id"],
      status: json["status"] == "processed" ? "Active" : "Inactive",
      apartment: json["customerId"], // replace when buildingName available
      liters: "${json["capacity"]} - ${json["type_of_water"]}",
      price: "₹${supplier["quoted_amount"] ?? "--"}",
      advance: "--",
      deliveries: "${json["dates"]?.length ?? 0} Deliveries",
      frequency: "${json["weekly_count"]}/week",
      waterType: json["type_of_water"],
    );
  }
}