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.
84 lines
2.6 KiB
Dart
84 lines
2.6 KiB
Dart
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
import 'package:mc_common_app/utils/enums.dart';
|
|
|
|
class ShippingRequestModel {
|
|
int? id;
|
|
int? requestID;
|
|
Request? request;
|
|
int? pickupOrshippingStatus;
|
|
ShippingRequestStatusEnum? shippingStatusEnum;
|
|
SelfPickupRequestStatusEnum? selfPickupRequestStatusEnum;
|
|
String? deliveredorCollectedOn;
|
|
String? comment;
|
|
String? createdOn;
|
|
int? customerID;
|
|
String? customerName;
|
|
int? vehicleTypeID;
|
|
String? vehicleType;
|
|
|
|
ShippingRequestModel({
|
|
this.id,
|
|
this.requestID,
|
|
this.request,
|
|
this.pickupOrshippingStatus,
|
|
this.deliveredorCollectedOn,
|
|
this.comment,
|
|
this.createdOn,
|
|
this.customerID,
|
|
this.customerName,
|
|
this.vehicleTypeID,
|
|
this.vehicleType,
|
|
});
|
|
|
|
ShippingRequestModel.fromJsonShipping(Map<String, dynamic> json, bool isForShipping) {
|
|
id = json['id'];
|
|
requestID = json['requestID'];
|
|
request = json['request'] != null ? Request.fromJson(json['request']) : null;
|
|
pickupOrshippingStatus = isForShipping ? json['shippingStatus'] : json['selfPickUpStatus'];
|
|
shippingStatusEnum = isForShipping ? (json['shippingStatus'] != null ? (json['shippingStatus'] as int).toShippingStatusEnum() : ShippingRequestStatusEnum.initiated) : null;
|
|
selfPickupRequestStatusEnum =
|
|
isForShipping ? null : (json['selfPickUpStatus'] != null ? (json['selfPickUpStatus'] as int).toSelfPickupStatusEnum() : SelfPickupRequestStatusEnum.preparingToCollect);
|
|
deliveredorCollectedOn = isForShipping ? json['deliveredOn'] : json['collectedOn'];
|
|
comment = json['comment'];
|
|
createdOn = json['createdOn'];
|
|
customerID = json['customerID'];
|
|
customerName = json['customerName'];
|
|
vehicleTypeID = json['vehicleTypeID'];
|
|
vehicleType = json['vehicleType'];
|
|
}
|
|
}
|
|
|
|
class Request {
|
|
int? requestType;
|
|
String? brand;
|
|
String? model;
|
|
int? year;
|
|
bool? isNew;
|
|
String? description;
|
|
double? price;
|
|
|
|
Request({this.requestType, this.brand, this.model, this.year, this.isNew, this.description, this.price});
|
|
|
|
Request.fromJson(Map<String, dynamic> json) {
|
|
requestType = json['requestType'];
|
|
brand = json['brand'];
|
|
model = json['model'];
|
|
year = json['year'];
|
|
isNew = json['isNew'];
|
|
description = json['description'];
|
|
price = json['price'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['requestType'] = requestType;
|
|
data['brand'] = brand;
|
|
data['model'] = model;
|
|
data['year'] = year;
|
|
data['isNew'] = isNew;
|
|
data['description'] = description;
|
|
data['price'] = price;
|
|
return data;
|
|
}
|
|
}
|