import 'package:mc_common_app/models/services/item_model.dart'; class ServiceModel { final int? serviceProviderServiceId; final dynamic providerServiceDescription; final int? categoryId; final String? categoryName; final int? serviceId; final String? serviceDescription; final String? serviceDescriptionN; final int? serviceStatus; final dynamic statusText; final bool? isAllowAppointment; final bool? isAllowAppointmentHome; final int? customerLocationRange; final String? rangePricePerKm; final int? itemsCount; List? serviceItems; bool isExpandedOrSelected; ServiceModel({ this.serviceProviderServiceId, this.providerServiceDescription, this.categoryId, this.categoryName, this.serviceId, this.serviceDescription, this.serviceDescriptionN, this.serviceStatus, this.statusText, this.isAllowAppointment, this.isAllowAppointmentHome, this.customerLocationRange, this.rangePricePerKm, this.itemsCount, this.serviceItems, required this.isExpandedOrSelected, }); factory ServiceModel.fromJson(Map json) => ServiceModel( serviceProviderServiceId: json["serviceProviderServiceID"], providerServiceDescription: json["providerServiceDescription"], categoryId: json["categoryID"], categoryName: json["categoryName"], serviceId: json["serviceID"], serviceDescription: json["serviceDescription"] ?? json["serviceName"], serviceDescriptionN: json["serviceDescriptionN"] ?? json["serviceNameN"], serviceStatus: json["serviceStatus"], statusText: json["statusText"], isAllowAppointment: json["isAllowAppointment"], isAllowAppointmentHome: json["isAllowAppointmentHome"], customerLocationRange: json["customerLocationRange"], rangePricePerKm: json["rangePricePerKm"].toString(), itemsCount: json["itemsCount"], serviceItems: json["branchServiceItems"] == null ? [] : List.from(json["branchServiceItems"]!.map((x) => ItemData.fromJson(x))), isExpandedOrSelected: false, ); Map toJson() => { "serviceProviderServiceID": serviceProviderServiceId, "providerServiceDescription": providerServiceDescription, "categoryID": categoryId, "categoryName": categoryName, "serviceID": serviceId, "serviceDescription": serviceDescription, "serviceDescriptionN": serviceDescriptionN, "serviceStatus": serviceStatus, "statusText": statusText, "isAllowAppointment": isAllowAppointment, "isAllowAppointmentHome": isAllowAppointmentHome, "customerLocationRange": customerLocationRange, "rangePricePerKm": rangePricePerKm, "itemsCount": itemsCount, "branchServiceItems": serviceItems == null ? [] : List.from(serviceItems!.map((x) => x.toJson())), }; }