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.
140 lines
4.3 KiB
Dart
140 lines
4.3 KiB
Dart
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
import 'package:mc_common_app/models/advertisment_models/ad_details_model.dart';
|
|
import 'package:mc_common_app/models/chat_models/chat_message_model.dart';
|
|
import 'package:mc_common_app/utils/enums.dart';
|
|
|
|
class RequestModel {
|
|
int requestType;
|
|
String requestTypeName;
|
|
String requestStatusName;
|
|
RequestStatusEnum requestStatus;
|
|
int? shippingStatus;
|
|
ShippingRequestStatusEnum? shippingStatusEnum;
|
|
String cityName;
|
|
String vehicleTypeName;
|
|
String countryName;
|
|
String customerName;
|
|
String customerID;
|
|
String address;
|
|
dynamic serviceProviders;
|
|
int offerCount;
|
|
int id;
|
|
int customerId;
|
|
bool isChatted;
|
|
String customerUserID;
|
|
dynamic customer;
|
|
String brand;
|
|
String model;
|
|
int year;
|
|
bool isNew;
|
|
String description;
|
|
List<GenericImageModel>? requestImages;
|
|
int cityId;
|
|
dynamic city;
|
|
double price;
|
|
int paymentStatus;
|
|
int vehicleTypeId;
|
|
int countryId;
|
|
List<dynamic> requestProviderItem;
|
|
bool isActive;
|
|
int createdBy;
|
|
String? createdOn;
|
|
int? modifiedBy;
|
|
String? modifiedOn;
|
|
List<ChatMessageModel> chatMessages;
|
|
|
|
RequestModel({
|
|
required this.requestType,
|
|
required this.requestTypeName,
|
|
required this.requestStatusName,
|
|
required this.requestStatus,
|
|
required this.shippingStatus,
|
|
required this.shippingStatusEnum,
|
|
required this.cityName,
|
|
required this.vehicleTypeName,
|
|
required this.countryName,
|
|
required this.customerName,
|
|
required this.customerID,
|
|
required this.serviceProviders,
|
|
required this.offerCount,
|
|
required this.id,
|
|
required this.customerId,
|
|
required this.isChatted,
|
|
required this.customerUserID,
|
|
required this.customer,
|
|
required this.address,
|
|
required this.brand,
|
|
required this.model,
|
|
required this.year,
|
|
required this.isNew,
|
|
required this.description,
|
|
required this.requestImages,
|
|
required this.cityId,
|
|
required this.city,
|
|
required this.price,
|
|
required this.paymentStatus,
|
|
required this.vehicleTypeId,
|
|
required this.countryId,
|
|
required this.requestProviderItem,
|
|
required this.isActive,
|
|
required this.createdBy,
|
|
required this.createdOn,
|
|
required this.modifiedBy,
|
|
required this.modifiedOn,
|
|
required this.chatMessages,
|
|
});
|
|
|
|
List<GenericImageModel> populateRequestImages(value) {
|
|
List<GenericImageModel> images = [];
|
|
if (value != null) {
|
|
value.forEach((v) {
|
|
images.add(GenericImageModel.fromJson(v));
|
|
});
|
|
}
|
|
return images;
|
|
}
|
|
|
|
factory RequestModel.fromJson(Map<String, dynamic> json) {
|
|
return RequestModel(
|
|
requestType: json["requestType"],
|
|
requestTypeName: json["requestTypeName"],
|
|
requestStatusName: json["requestStatusName"],
|
|
requestStatus: (json['requestStatus'] as int).toRequestStatusEnum(),
|
|
shippingStatus: json['shippingRequestStatus'],
|
|
shippingStatusEnum: json['shippingRequestStatus'] != null ? (json['shippingRequestStatus'] as int).toShippingStatusEnum() : ShippingRequestStatusEnum.pending,
|
|
cityName: json["cityName"],
|
|
vehicleTypeName: json["vehicleTypeName"],
|
|
countryName: json["countryName"],
|
|
customerName: json["customerName"] ?? "",
|
|
address: json["address"] ?? "",
|
|
customerID: json["customerUserID"],
|
|
serviceProviders: json["serviceProviders"],
|
|
offerCount: json["offerCount"],
|
|
id: json["id"],
|
|
customerId: json["customerID"],
|
|
isChatted: json["isChatted"],
|
|
customerUserID: json["customerUserID"],
|
|
customer: json["customer"],
|
|
brand: json["brand"],
|
|
model: json["model"],
|
|
year: json["year"],
|
|
isNew: json["isNew"],
|
|
description: json["description"],
|
|
requestImages: List<GenericImageModel>.from(json["requestImages"].map((x) => GenericImageModel.fromJson(x))),
|
|
cityId: json["cityID"],
|
|
city: json["city"],
|
|
price: json["price"],
|
|
paymentStatus: json["paymentStatus"],
|
|
vehicleTypeId: json["vehicleTypeID"],
|
|
countryId: json["countryID"],
|
|
requestProviderItem: List<dynamic>.from(json["requestProviderItem"].map((x) => x)),
|
|
isActive: json["isActive"],
|
|
createdBy: json["createdBy"],
|
|
createdOn: json["createdOn"],
|
|
modifiedBy: json["modifiedBy"],
|
|
modifiedOn: json["modifiedOn"],
|
|
chatMessages: [],
|
|
);
|
|
}
|
|
}
|