import 'dart:convert'; class ItemsDataResponse { final List rows; ItemsDataResponse({ required this.rows, }); factory ItemsDataResponse.fromRawJson(String str) => ItemsDataResponse.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory ItemsDataResponse.fromJson(Map json) => ItemsDataResponse( rows: List.from(json["rows"].map((x) => GymItem.fromJson(x))), ); Map toJson() => { "rows": List.from(rows.map((x) => x.toJson())), }; } class GymItem { final String id; final String externalId; final String title; final String description; final int count; final double price; final String categoryId; final List images; int localCount = 0; GymItem({ required this.id, required this.externalId, required this.title, required this.description, required this.count, required this.price, required this.categoryId, required this.images, }); factory GymItem.fromRawJson(String str) => GymItem.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory GymItem.fromJson(Map json) => GymItem( id: json["id"], externalId: json["ExternalId"], title: json["title"], description: json["description"], count: json["count"], price: json["price"] / 100, categoryId: json["categoryId"], images: List.from( json["images"].map((x) => GymImage.fromJson(x))), ); Map toJson() => { "id": id, "ExternalId": externalId, "title": title, "description": description, "count": count, "price": price, "categoryId": categoryId, "images": List.from(images.map((x) => x.toJson())), }; } class GymImage { final String id; final dynamic deletedAt; final String url; GymImage({ required this.id, required this.deletedAt, required this.url, }); factory GymImage.fromRawJson(String str) => GymImage.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory GymImage.fromJson(Map json) => GymImage( id: json["id"], deletedAt: json["deletedAt"], url: json["url"], ); Map toJson() => { "id": id, "deletedAt": deletedAt, "url": url, }; } class CategoryDataResponse { final List rows; CategoryDataResponse({ required this.rows, }); factory CategoryDataResponse.fromRawJson(String str) => CategoryDataResponse.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory CategoryDataResponse.fromJson(Map json) => CategoryDataResponse( rows: List.from( json["rows"].map((x) => GymCategory.fromJson(x))), ); Map toJson() => { "rows": List.from(rows.map((x) => x.toJson())), }; } class GymCategory { final String id; final String name; GymCategory({ required this.id, required this.name, }); factory GymCategory.fromRawJson(String str) => GymCategory.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory GymCategory.fromJson(Map json) => GymCategory( id: json["id"], name: json["name"], ); Map toJson() => { "id": id, "name": name, }; } class GymHistoryItem { final String id; final String date; final String sum; final String photo; GymHistoryItem({ required this.id, required this.date, required this.sum, required this.photo, }); factory GymHistoryItem.fromRawJson(String str) => GymHistoryItem.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory GymHistoryItem.fromJson(Map json) => GymHistoryItem( id: json["id"], date: json["date"], sum: json["sum"], photo: json["photo"], ); Map toJson() => { "id": id, "date": date, "sum": sum, "photo": photo, }; } class GymHistoryItemDetail { final String id; final String date; final String sum; String? payUrl; final String receiver; final String email; final String address; final List providers; GymHistoryItemDetail({ required this.id, required this.date, required this.sum, this.payUrl, required this.providers, required this.receiver, required this.email, required this.address, }); factory GymHistoryItemDetail.fromRawJson(String str) => GymHistoryItemDetail.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory GymHistoryItemDetail.fromJson(Map json) => GymHistoryItemDetail( id: json["id"], date: json["date"], sum: json["sum"], receiver: json["receiver"], email: json["email"], address: json["address"], payUrl: json["pay_url"], providers: List.from(json["providers"] .map((x) => GymHistoryItemDetailProvider.fromJson(x))), ); Map toJson() => { "id": id, "date": date, "sum": sum, "pay_url": payUrl, "providers": List.from(providers.map((x) => x.toJson())), "receiver": receiver, "email": email, "address": address, }; } class GymHistoryItemDetailProvider { final String id; final String name; final String status; final List items; GymHistoryItemDetailProvider({ required this.id, required this.name, required this.status, required this.items, }); factory GymHistoryItemDetailProvider.fromRawJson(String str) => GymHistoryItemDetailProvider.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory GymHistoryItemDetailProvider.fromJson(Map json) => GymHistoryItemDetailProvider( id: json["id"], name: json["name"], status: json["status"], items: List.from( json["items"].map((x) => GymHistoryItemDetailItem.fromJson(x))), ); Map toJson() => { "id": id, "name": name, "status": status, "items": List.from(items.map((x) => x.toJson())), }; } class GymHistoryItemDetailItem { final String photo; final String id; final int count; final String price; GymHistoryItemDetailItem({ required this.photo, required this.id, required this.count, required this.price, }); factory GymHistoryItemDetailItem.fromRawJson(String str) => GymHistoryItemDetailItem.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory GymHistoryItemDetailItem.fromJson(Map json) => GymHistoryItemDetailItem( photo: json["photo"], id: json["id"], count: json["count"], price: json["price"], ); Map toJson() => { "photo": photo, "id": id, "count": count, "price": price, }; }