class ChooseAirConditionContentState{
  //  totalPrice
  get totalPrice {
    final prices = checkedServiceList?.map((item) => (item.num ?? 0) * (item.price ?? 0)).toList();
    return prices?.isNotEmpty == true ? prices?.reduce((before, current) => before + current) : 0;
  }
  get checkedServiceList => airConditionList?.where((item) => ((item.num??0)>0? true:false))?.toList() ?? [];
  // hasCheckdService
  get hasCheckdService => checkedServiceList?.any((item) => ((item.num??0)>0? true:false)) ?? false;

  List<AirConditionContentItem> airConditionList = [];

  ChooseAirConditionContentState({
    required this.airConditionList,
  });

  ChooseAirConditionContentState copyWith({
    List<AirConditionContentItem>? airConditionList,
  }){
    return ChooseAirConditionContentState(
      airConditionList: airConditionList??this.airConditionList,
    );
  }
}

class AirConditionContentItem{
  String? name;
  int? id;
  int? num;
  double? price;
  AirConditionContentItem({
    this.name,
    this.id,
    this.num,
    this.price
  });

  AirConditionContentItem copyWith({
    String? name,
    int? id,
    int? num,
    double? price
  }){
    return AirConditionContentItem(
      name: name??this.name,
      id: id??this.id,
      num: num??this.num,
      price: price??this.price
    );
  }
}