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.
diplomatic-quarter/lib/models/pharmacy/productDetailModel.dart

244 lines
6.7 KiB
Dart

import 'dart:convert';
List<ProductDetail> productDetailFromJson(String str) => List<ProductDetail>.from(json.decode(str).map((x) => ProductDetail.fromJson(x)));
String productDetailToJson(List<ProductDetail> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class ProductDetail {
ProductDetail({
this.reviews,
});
List<Review> reviews;
factory ProductDetail.fromJson(Map<String, dynamic> json) => ProductDetail(
reviews: List<Review>.from(json["reviews"].map((x) => Review.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"reviews": List<dynamic>.from(reviews.map((x) => x.toJson())),
};
}
class Review {
Review({
this.id,
this.position,
this.reviewId,
this.customerId,
this.productId,
this.storeId,
this.isApproved,
this.title,
this.reviewText,
this.replyText,
this.rating,
this.helpfulYesTotal,
this.helpfulNoTotal,
this.createdOnUtc,
this.customer,
this.product,
});
int id;
int position;
int reviewId;
int customerId;
int productId;
int storeId;
bool isApproved;
String title;
String reviewText;
dynamic replyText;
int rating;
int helpfulYesTotal;
int helpfulNoTotal;
DateTime createdOnUtc;
Customer customer;
dynamic product;
factory Review.fromJson(Map<String, dynamic> json) => Review(
id: json["id"],
position: json["position"],
reviewId: json["review_id"],
customerId: json["customer_id"],
productId: json["product_id"],
storeId: json["store_id"],
isApproved: json["is_approved"],
title: json["title"],
reviewText: json["review_text"],
replyText: json["reply_text"],
rating: json["rating"],
helpfulYesTotal: json["helpful_yes_total"],
helpfulNoTotal: json["helpful_no_total"],
createdOnUtc: DateTime.parse(json["created_on_utc"]),
customer: Customer.fromJson(json["customer"]),
product: json["product"],
);
Map<String, dynamic> toJson() => {
"id": id,
"position": position,
"review_id": reviewId,
"customer_id": customerId,
"product_id": productId,
"store_id": storeId,
"is_approved": isApproved,
"title": title,
"review_text": reviewText,
"reply_text": replyText,
"rating": rating,
"helpful_yes_total": helpfulYesTotal,
"helpful_no_total": helpfulNoTotal,
"created_on_utc": createdOnUtc.toIso8601String(),
"customer": customer.toJson(),
"product": product,
};
}
class Customer {
Customer({
this.fileNumber,
this.iqamaNumber,
this.isOutSa,
this.patientType,
this.gender,
this.birthDate,
this.phone,
this.countryCode,
this.yahalaAccountno,
this.billingAddress,
this.shippingAddress,
this.id,
this.username,
this.email,
this.firstName,
this.lastName,
this.languageId,
this.adminComment,
this.isTaxExempt,
this.hasShoppingCartItems,
this.active,
this.deleted,
this.isSystemAccount,
this.systemName,
this.lastIpAddress,
this.createdOnUtc,
this.lastLoginDateUtc,
this.lastActivityDateUtc,
this.registeredInStoreId,
});
dynamic fileNumber;
dynamic iqamaNumber;
int isOutSa;
int patientType;
dynamic gender;
DateTime birthDate;
dynamic phone;
dynamic countryCode;
dynamic yahalaAccountno;
dynamic billingAddress;
dynamic shippingAddress;
String id;
Email username;
Email email;
dynamic firstName;
dynamic lastName;
dynamic languageId;
dynamic adminComment;
dynamic isTaxExempt;
dynamic hasShoppingCartItems;
dynamic active;
dynamic deleted;
dynamic isSystemAccount;
dynamic systemName;
dynamic lastIpAddress;
dynamic createdOnUtc;
dynamic lastLoginDateUtc;
dynamic lastActivityDateUtc;
dynamic registeredInStoreId;
factory Customer.fromJson(Map<String, dynamic> json) => Customer(
fileNumber: json["file_number"],
iqamaNumber: json["iqama_number"],
isOutSa: json["is_out_sa"],
patientType: json["patient_type"],
gender: json["gender"],
birthDate: DateTime.parse(json["birth_date"]),
phone: json["phone"],
countryCode: json["country_code"],
yahalaAccountno: json["yahala_accountno"],
billingAddress: json["billing_address"],
shippingAddress: json["shipping_address"],
id: json["id"],
username: emailValues.map[json["username"]],
email: emailValues.map[json["email"]],
firstName: json["first_name"],
lastName: json["last_name"],
languageId: json["language_id"],
adminComment: json["admin_comment"],
isTaxExempt: json["is_tax_exempt"],
hasShoppingCartItems: json["has_shopping_cart_items"],
active: json["active"],
deleted: json["deleted"],
isSystemAccount: json["is_system_account"],
systemName: json["system_name"],
lastIpAddress: json["last_ip_address"],
createdOnUtc: json["created_on_utc"],
lastLoginDateUtc: json["last_login_date_utc"],
lastActivityDateUtc: json["last_activity_date_utc"],
registeredInStoreId: json["registered_in_store_id"],
);
Map<String, dynamic> toJson() => {
"file_number": fileNumber,
"iqama_number": iqamaNumber,
"is_out_sa": isOutSa,
"patient_type": patientType,
"gender": gender,
"birth_date": birthDate.toIso8601String(),
"phone": phone,
"country_code": countryCode,
"yahala_accountno": yahalaAccountno,
"billing_address": billingAddress,
"shipping_address": shippingAddress,
"id": id,
"username": emailValues.reverse[username],
"email": emailValues.reverse[email],
"first_name": firstName,
"last_name": lastName,
"language_id": languageId,
"admin_comment": adminComment,
"is_tax_exempt": isTaxExempt,
"has_shopping_cart_items": hasShoppingCartItems,
"active": active,
"deleted": deleted,
"is_system_account": isSystemAccount,
"system_name": systemName,
"last_ip_address": lastIpAddress,
"created_on_utc": createdOnUtc,
"last_login_date_utc": lastLoginDateUtc,
"last_activity_date_utc": lastActivityDateUtc,
"registered_in_store_id": registeredInStoreId,
};
}
enum Email { STEVE_GATES_NOP_COMMERCE_COM }
final emailValues = EnumValues({"steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM});
class EnumValues<T> {
Map<String, T> map;
Map<T, String> reverseMap;
EnumValues(this.map);
Map<T, String> get reverse {
if (reverseMap == null) {
reverseMap = map.map((k, v) => new MapEntry(v, k));
}
return reverseMap;
}
}