Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Order {
- String? id;
- String? promoCodeId;
- String? clientId;
- String? createdAt;
- String? updatedAt;
- double? amountToPay;
- String? companyId;
- String? deletedAt;
- int? status;
- PromoCode? promoCode;
- List<Sale>? sales;
- User? client;
- Order({
- this.id,
- this.promoCodeId,
- this.clientId,
- this.createdAt,
- this.updatedAt,
- this.amountToPay,
- this.companyId,
- this.deletedAt,
- this.status,
- this.promoCode,
- this.sales,
- this.client,
- });
- Order.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- promoCodeId = json['promo_code_id'];
- clientId = json['client_id'];
- createdAt = json['created_at'];
- updatedAt = json['updated_at'];
- amountToPay = json['amount_to_pay']?.toDouble();
- companyId = json['company_id'];
- deletedAt = json['deleted_at'];
- status = json['status'];
- promoCode = json['promo_code'] != null ? PromoCode.fromJson(json['promo_code']) : null;
- if (json['sales'] != null) {
- sales = [];
- json['sales'].forEach((v) {
- sales!.add(Sale.fromJson(v));
- });
- }
- client = json['client'] != null ? User.fromJson(json['client']) : null;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = Map<String, dynamic>();
- data['id'] = this.id;
- data['promo_code_id'] = this.promoCodeId;
- data['client_id'] = this.clientId;
- data['created_at'] = this.createdAt;
- data['updated_at'] = this.updatedAt;
- data['amount_to_pay'] = this.amountToPay;
- data['company_id'] = this.companyId;
- data['deleted_at'] = this.deletedAt;
- data['status'] = this.status;
- if (this.client != null) {
- data['promo_code'] = this.promoCode!.toJson();
- }
- if (this.sales != null) {
- data['sales'] = this.sales!.map((v) => v.toJson()).toList();
- }
- if (this.client != null) {
- data['client'] = this.client!.toJson();
- }
- return data;
- }
- }
- class Sale {
- String? id;
- String? saleableType;
- String? saleableId;
- String? userId;
- String? saleDate;
- String? toBeUsedOn;
- String? useDate;
- double? salePrice;
- String? createdAt;
- String? updatedAt;
- String? beneficiary;
- dynamic saleable;
- Sale({
- this.id,
- this.saleableType,
- this.saleableId,
- this.userId,
- this.saleDate,
- this.useDate,
- this.salePrice,
- this.createdAt,
- this.updatedAt,
- this.beneficiary,
- this.saleable,
- });
- Sale.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- saleableType = json['saleable_type'];
- saleableId = json['saleable_id'];
- userId = json['user_id'];
- saleDate = json['sale_date'];
- toBeUsedOn = json['to_be_used_on'];
- useDate = json['use_date'] ?? null;
- salePrice = json['sale_price']?.toDouble();
- createdAt = json['created_at'];
- updatedAt = json['updated_at'];
- beneficiary = json['beneficiary'];
- if (saleableType!.contains(saleableTypes[0])) {
- saleable = json['saleable'] != null ? SaleableCourse.fromJson(json['saleable']) : null;
- } else if (saleableType!.contains(saleableTypes[1])) {
- saleable = json['saleable'] != null ? SaleableDayPass.fromJson(json['saleable']) : null;
- } else if (saleableType!.contains(saleableTypes[2])) {
- saleable = json['saleable'] != null ? SaleableEvent.fromJson(json['saleable']) : null;
- } else {
- saleable = json['saleable'] != null ? SaleableSubscription.fromJson(json['saleable']) : null;
- }
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = Map<String, dynamic>();
- data['id'] = this.id;
- data['saleable_type'] = this.saleableType;
- data['saleable_id'] = this.saleableId;
- data['user_id'] = this.userId;
- data['sale_date'] = this.saleDate;
- data['to_be_used_on'] = this.toBeUsedOn;
- data['use_date'] = this.useDate;
- data['sale_price'] = this.salePrice;
- data['created_at'] = this.createdAt;
- data['updated_at'] = this.updatedAt;
- data['beneficiary'] = this.beneficiary;
- if (this.saleable != null) {
- data['saleable'] = this.saleable.toJson();
- }
- return data;
- }
- }
- class SaleableCourse {
- String? id;
- String? date;
- int? stock;
- double? nomadPrice;
- double? companyPrice;
- String? title;
- String? courseId;
- String? planningId;
- String? createdAt;
- String? updatedAt;
- Course? course;
- SaleableCourse({
- this.id,
- this.date,
- this.stock,
- this.nomadPrice,
- this.companyPrice,
- this.courseId,
- this.planningId,
- this.title,
- this.createdAt,
- this.updatedAt,
- this.course,
- });
- SaleableCourse.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- date = json['date'];
- stock = json['stock'];
- nomadPrice = json['nomad_price']?.toDouble();
- companyPrice = json['company_price']?.toDouble();
- title = json['title'];
- courseId = json['course_id'];
- planningId = json['planning_id'];
- createdAt = json['created_at'];
- updatedAt = json['updated_at'];
- course = json['course'] != null ? Course.fromJson(json['course']) : null;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = Map<String, dynamic>();
- data['id'] = this.id;
- data['date'] = this.date;
- data['stock'] = this.stock;
- data['nomad_price'] = this.nomadPrice;
- data['company_price'] = this.companyPrice;
- data['title'] = this.title;
- data['course_id'] = this.courseId;
- data['planning_id'] = this.planningId;
- data['created_at'] = this.createdAt;
- data['updated_at'] = this.updatedAt;
- if (this.course != null) {
- data['course'] = this.course!.toJson();
- }
- return data;
- }
- }
- class SaleableDayPass {
- String? id;
- int? dayOrder;
- String? partnerId;
- String? name;
- double? nomadPrice;
- double? companyPrice;
- String? createdAt;
- String? updatedAt;
- SaleableDayPass({
- this.id,
- this.dayOrder,
- this.partnerId,
- this.name,
- this.nomadPrice,
- this.companyPrice,
- this.createdAt,
- this.updatedAt,
- });
- SaleableDayPass.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- dayOrder = json['day_order'];
- partnerId = json['partner_id'];
- name = json['name'];
- nomadPrice = json['nomad_price'].toDouble() ?? null;
- companyPrice = json['company_price'].toDouble() ?? null;
- createdAt = json['created_at'];
- updatedAt = json['updated_at'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = Map<String, dynamic>();
- data['id'] = this.id;
- data['day_order'] = this.dayOrder;
- data['partner_id'] = this.partnerId;
- data['name'] = this.name;
- data['nomad_price'] = this.nomadPrice;
- data['company_price'] = this.companyPrice;
- data['created_at'] = this.createdAt;
- data['updated_at'] = this.updatedAt;
- return data;
- }
- }
- class SaleableEvent {
- String? id;
- String? name;
- String? description;
- String? startDate;
- String? endDate;
- double? nomadPrice;
- double? companyPrice;
- String? image;
- int? stock;
- int? level;
- String? activityId;
- String? partnerId;
- String? createdAt;
- String? updatedAt;
- SaleableEvent({
- this.id,
- this.name,
- this.description,
- this.startDate,
- this.endDate,
- this.nomadPrice,
- this.image,
- this.stock,
- this.level,
- this.activityId,
- this.partnerId,
- this.createdAt,
- this.updatedAt,
- });
- SaleableEvent.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- name = json['name'];
- description = json['description'];
- startDate = json['start_date'];
- endDate = json['end_date'];
- nomadPrice = json['nomad_price']?.toDouble();
- companyPrice = json['company_price']?.toDouble();
- image = json['image'];
- stock = json['stock'];
- level = json['level'];
- activityId = json['activity_id'];
- partnerId = json['partner_id'];
- createdAt = json['created_at'];
- updatedAt = json['updated_at'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = Map<String, dynamic>();
- data['id'] = this.id;
- data['name'] = this.name;
- data['description'] = this.description;
- data['start_date'] = this.startDate;
- data['end_date'] = this.endDate;
- data['nomad_price'] = this.nomadPrice;
- data['company_price'] = this.companyPrice;
- data['image'] = this.image;
- data['stock'] = this.stock;
- data['level'] = this.level;
- data['activity_id'] = this.activityId;
- data['partner_id'] = this.partnerId;
- data['created_at'] = this.createdAt;
- data['updated_at'] = this.updatedAt;
- return data;
- }
- }
- class SaleableSubscription {
- String? id;
- String? name;
- String? description;
- double? nomadPrice;
- double? companyPrice;
- int? stock;
- int? initialStock;
- int? numberOfUse;
- int? duration;
- String? image;
- String? createdAt;
- String? updatedAt;
- String? deletedAt;
- SaleableSubscription(
- {this.id,
- this.name,
- this.description,
- this.nomadPrice,
- this.companyPrice,
- this.stock,
- this.initialStock,
- this.numberOfUse,
- this.duration,
- this.image,
- this.createdAt,
- this.updatedAt,
- this.deletedAt});
- SaleableSubscription.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- name = json['name'];
- description = json['description'];
- nomadPrice = json['nomad_price']?.toDouble();
- companyPrice = json['company_price']?.toDouble();
- stock = json['stock'];
- initialStock = json['initial_stock'];
- numberOfUse = json['number_of_use'];
- duration = json['duration'];
- image = json['image'];
- createdAt = json['created_at'];
- updatedAt = json['updated_at'];
- deletedAt = json['deleted_at'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['name'] = this.name;
- data['description'] = this.description;
- data['nomad_price'] = this.nomadPrice;
- data['company_price'] = this.companyPrice;
- data['stock'] = this.stock;
- data['initial_stock'] = this.initialStock;
- data['number_of_use'] = this.numberOfUse;
- data['duration'] = this.duration;
- data['image'] = this.image;
- data['created_at'] = this.createdAt;
- data['updated_at'] = this.updatedAt;
- data['deleted_at'] = this.deletedAt;
- return data;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement