You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
car_common_app/lib/models/services_models/item_model.dart

114 lines
3.8 KiB
Dart

// To parse this JSON data, do
//
// final itemModel = itemModelFromJson(jsonString);
import 'dart:convert';
ItemModel itemModelFromJson(String str) => ItemModel.fromJson(json.decode(str));
String itemModelToJson(ItemModel data) => json.encode(data.toJson());
class ItemModel {
final int? messageStatus;
final int? totalItemsCount;
final List<ItemData>? data;
final String? message;
ItemModel({
this.messageStatus,
this.totalItemsCount,
this.data,
this.message,
});
factory ItemModel.fromJson(Map<String, dynamic> json) => ItemModel(
messageStatus: json["messageStatus"],
totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? [] : List<ItemData>.from(json["data"]!.map((x) => ItemData.fromJson(x))),
message: json["message"],
);
Map<String, dynamic> toJson() => {
"messageStatus": messageStatus,
"totalItemsCount": totalItemsCount,
"data": data == null ? [] : List<dynamic>.from(data!.map((x) => x.toJson())),
"message": message,
};
}
class ItemData {
final int? id;
final String? name;
final String? price;
final String? manufactureDate;
final String? description;
final dynamic pictureUrl;
final int? companyId;
final int? serviceProviderServiceId;
final String? serviceProviderServiceDescription;
final bool? isActive;
final bool? isAllowAppointment;
final bool? isAppointmentCompanyLoc;
final bool? isAppointmentCustomerLoc;
final double? appointmentPricePercentage;
bool? isUpdateOrSelected;
bool? isHomeSelected;
ItemData({
this.id,
this.name,
this.price,
this.manufactureDate,
this.description,
this.pictureUrl,
this.companyId,
this.serviceProviderServiceId,
this.serviceProviderServiceDescription,
this.isActive,
this.isAllowAppointment,
this.isAppointmentCompanyLoc,
this.isAppointmentCustomerLoc,
this.appointmentPricePercentage,
this.isUpdateOrSelected,
this.isHomeSelected,
});
factory ItemData.fromJson(Map<String, dynamic> json) => ItemData(
id: json["id"],
name: json["name"],
price: json["price"].toString(),
manufactureDate: json["manufactureDate"],
description: json["description"],
pictureUrl: json["pictureUrl"],
companyId: json["companyID"],
serviceProviderServiceId: json["serviceProviderServiceID"],
serviceProviderServiceDescription: json["serviceProviderServiceDescription"],
isActive: json["isActive"],
isAllowAppointment: json["isAllowAppointment"],
isAppointmentCompanyLoc: json["isAppointmentCompanyLoc"],
isAppointmentCustomerLoc: json["isAppointmentCustomerLoc"],
isUpdateOrSelected: false,
isHomeSelected: false,
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"price": price,
"manufactureDate": manufactureDate,
"description": description,
"pictureUrl": pictureUrl,
"companyID": companyId,
"serviceProviderServiceID": serviceProviderServiceId,
"isActive": isActive,
"isAllowAppointment": isAllowAppointment,
"isAppointmentCompanyLoc": isAppointmentCompanyLoc,
"isAppointmentCustomerLoc": isAppointmentCustomerLoc,
};
@override
String toString() {
return 'ItemData{id: $id, name: $name, price: $price, manufactureDate: $manufactureDate, description: $description, pictureUrl: $pictureUrl, companyId: $companyId, serviceProviderServiceId: $serviceProviderServiceId, serviceProviderServiceDescription: $serviceProviderServiceDescription, isActive: $isActive, isAllowAppointment: $isAllowAppointment, isAppointmentCompanyLoc: $isAppointmentCompanyLoc, isAppointmentCustomerLoc: $isAppointmentCustomerLoc, appointmentPricePercentage: $appointmentPricePercentage, isUpdateOrSelected: $isUpdateOrSelected}';
}
}