|
|
|
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:mc_common_app/models/advertisment_models/special_service_model.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/enums.dart';
|
|
|
|
|
|
|
|
|
|
class AdDetailsModel {
|
|
|
|
|
int? id;
|
|
|
|
|
String? startdate;
|
|
|
|
|
String? enddate;
|
|
|
|
|
Vehicle? vehicle;
|
|
|
|
|
List<SpecialServiceModel>? specialservice;
|
|
|
|
|
|
|
|
|
|
// List<Null>? reserved;
|
|
|
|
|
int? statusID;
|
|
|
|
|
String? statuslabel;
|
|
|
|
|
double? adsDurationPrice;
|
|
|
|
|
double? adsDurationDiscount;
|
|
|
|
|
double? adsDurationDiscountPrice;
|
|
|
|
|
String? comment;
|
|
|
|
|
bool? active;
|
|
|
|
|
bool? isPaid;
|
|
|
|
|
bool? isSubscription;
|
|
|
|
|
bool? isVerified;
|
|
|
|
|
double? netPrice;
|
|
|
|
|
double? specialServiceTotalPrice;
|
|
|
|
|
double? taxPrice;
|
|
|
|
|
double? totalPrice;
|
|
|
|
|
String? userID;
|
|
|
|
|
int? vehiclePostingID;
|
|
|
|
|
String? qrCodePath;
|
|
|
|
|
bool? isCustomerAcknowledged;
|
|
|
|
|
int? createdByRole;
|
|
|
|
|
int? totalViews;
|
|
|
|
|
String? createdOn;
|
|
|
|
|
double? priceExcludingDiscount;
|
|
|
|
|
double? reservePrice;
|
|
|
|
|
bool? isMCHandled;
|
|
|
|
|
String? modifiedOn;
|
|
|
|
|
AdPostStatus? adPostStatus;
|
|
|
|
|
|
|
|
|
|
AdDetailsModel(
|
|
|
|
|
{this.id,
|
|
|
|
|
this.startdate,
|
|
|
|
|
this.enddate,
|
|
|
|
|
this.vehicle,
|
|
|
|
|
this.specialservice,
|
|
|
|
|
// this.reserved,
|
|
|
|
|
this.statusID,
|
|
|
|
|
this.statuslabel,
|
|
|
|
|
this.adsDurationPrice,
|
|
|
|
|
this.adsDurationDiscount,
|
|
|
|
|
this.adsDurationDiscountPrice,
|
|
|
|
|
this.comment,
|
|
|
|
|
this.active,
|
|
|
|
|
this.isPaid,
|
|
|
|
|
this.isSubscription,
|
|
|
|
|
this.isVerified,
|
|
|
|
|
this.netPrice,
|
|
|
|
|
this.specialServiceTotalPrice,
|
|
|
|
|
this.taxPrice,
|
|
|
|
|
this.totalPrice,
|
|
|
|
|
this.userID,
|
|
|
|
|
this.vehiclePostingID,
|
|
|
|
|
this.qrCodePath,
|
|
|
|
|
this.isCustomerAcknowledged,
|
|
|
|
|
this.createdByRole,
|
|
|
|
|
this.totalViews,
|
|
|
|
|
this.createdOn,
|
|
|
|
|
this.priceExcludingDiscount,
|
|
|
|
|
this.reservePrice,
|
|
|
|
|
this.isMCHandled,
|
|
|
|
|
this.adPostStatus,
|
|
|
|
|
this.modifiedOn});
|
|
|
|
|
|
|
|
|
|
AdDetailsModel.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
startdate = json['startdate'];
|
|
|
|
|
enddate = json['enddate'];
|
|
|
|
|
vehicle = json['vehicle'] != null ? Vehicle.fromJson(json['vehicle']) : null;
|
|
|
|
|
if (json['specialservice'] != null) {
|
|
|
|
|
specialservice = <SpecialServiceModel>[];
|
|
|
|
|
json['specialservice'].forEach((v) {
|
|
|
|
|
specialservice!.add(SpecialServiceModel.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// if (json['reserved'] != null) {
|
|
|
|
|
// reserved = <Null>[];
|
|
|
|
|
// json['reserved'].forEach((v) {
|
|
|
|
|
// reserved!.add(Null.fromJson(v));
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
statusID = json['statusID'];
|
|
|
|
|
statuslabel = json['statuslabel'];
|
|
|
|
|
adsDurationPrice = json['adsDurationPrice'];
|
|
|
|
|
adsDurationDiscount = json['adsDurationDiscount'];
|
|
|
|
|
adsDurationDiscountPrice = json['adsDurationDiscountPrice'];
|
|
|
|
|
comment = json['comment'];
|
|
|
|
|
active = json['active'];
|
|
|
|
|
isPaid = json['isPaid'];
|
|
|
|
|
isSubscription = json['isSubscription'];
|
|
|
|
|
isVerified = json['isVerified'];
|
|
|
|
|
netPrice = json['netPrice'];
|
|
|
|
|
specialServiceTotalPrice = json['specialServiceTotalPrice'];
|
|
|
|
|
taxPrice = json['taxPrice'];
|
|
|
|
|
totalPrice = json['totalPrice'];
|
|
|
|
|
userID = json['userID'];
|
|
|
|
|
vehiclePostingID = json['vehiclePostingID'];
|
|
|
|
|
qrCodePath = json['qrCodePath'];
|
|
|
|
|
isCustomerAcknowledged = json['isCustomerAcknowledged'];
|
|
|
|
|
createdByRole = json['createdByRole'];
|
|
|
|
|
totalViews = json['totalViews'];
|
|
|
|
|
createdOn = json['createdOn'];
|
|
|
|
|
priceExcludingDiscount = json['priceExcludingDiscount'];
|
|
|
|
|
reservePrice = json['reservePrice'];
|
|
|
|
|
isMCHandled = json['isMCHandled'];
|
|
|
|
|
modifiedOn = json['modifiedOn'];
|
|
|
|
|
adPostStatus = (json['statusID'] as int).toAdPostEnum();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
|
data['id'] = id;
|
|
|
|
|
data['startdate'] = startdate;
|
|
|
|
|
data['enddate'] = enddate;
|
|
|
|
|
if (vehicle != null) {
|
|
|
|
|
data['vehicle'] = vehicle!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if (specialservice != null) {
|
|
|
|
|
data['specialservice'] = specialservice!.map((v) => v.toJson()).toList();
|
|
|
|
|
}
|
|
|
|
|
// if (reserved != null) {
|
|
|
|
|
// data['reserved'] = reserved!.map((v) => v.toJson()).toList();
|
|
|
|
|
// }
|
|
|
|
|
data['statusID'] = statusID;
|
|
|
|
|
data['statuslabel'] = statuslabel;
|
|
|
|
|
data['adsDurationPrice'] = adsDurationPrice;
|
|
|
|
|
data['adsDurationDiscount'] = adsDurationDiscount;
|
|
|
|
|
data['adsDurationDiscountPrice'] = adsDurationDiscountPrice;
|
|
|
|
|
data['comment'] = comment;
|
|
|
|
|
data['active'] = active;
|
|
|
|
|
data['isPaid'] = isPaid;
|
|
|
|
|
data['isSubscription'] = isSubscription;
|
|
|
|
|
data['isVerified'] = isVerified;
|
|
|
|
|
data['netPrice'] = netPrice;
|
|
|
|
|
data['specialServiceTotalPrice'] = specialServiceTotalPrice;
|
|
|
|
|
data['taxPrice'] = taxPrice;
|
|
|
|
|
data['totalPrice'] = totalPrice;
|
|
|
|
|
data['userID'] = userID;
|
|
|
|
|
data['vehiclePostingID'] = vehiclePostingID;
|
|
|
|
|
data['qrCodePath'] = qrCodePath;
|
|
|
|
|
data['isCustomerAcknowledged'] = isCustomerAcknowledged;
|
|
|
|
|
data['createdByRole'] = createdByRole;
|
|
|
|
|
data['totalViews'] = totalViews;
|
|
|
|
|
data['createdOn'] = createdOn;
|
|
|
|
|
data['priceExcludingDiscount'] = priceExcludingDiscount;
|
|
|
|
|
data['reservePrice'] = reservePrice;
|
|
|
|
|
data['isMCHandled'] = isMCHandled;
|
|
|
|
|
data['modifiedOn'] = modifiedOn;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Vehicle {
|
|
|
|
|
int? id;
|
|
|
|
|
int? cityID;
|
|
|
|
|
String? cityName;
|
|
|
|
|
double? demandAmount;
|
|
|
|
|
bool? isActive;
|
|
|
|
|
bool? isFinanceAvailable;
|
|
|
|
|
int? status;
|
|
|
|
|
String? statustext;
|
|
|
|
|
Category? category;
|
|
|
|
|
Category? color;
|
|
|
|
|
Condition? condition;
|
|
|
|
|
Mileage? mileage;
|
|
|
|
|
Condition? model;
|
|
|
|
|
ModelYear? modelyear;
|
|
|
|
|
Condition? sellertype;
|
|
|
|
|
Condition? transmission;
|
|
|
|
|
Duration? duration;
|
|
|
|
|
List<AdImage>? image;
|
|
|
|
|
List<DamageReport>? damagereport;
|
|
|
|
|
String? vehicleDescription;
|
|
|
|
|
String? vehicleTitle;
|
|
|
|
|
int? vehicleType;
|
|
|
|
|
String? vehicleVIN;
|
|
|
|
|
int? countryID;
|
|
|
|
|
String? currency;
|
|
|
|
|
|
|
|
|
|
Vehicle(
|
|
|
|
|
{this.id,
|
|
|
|
|
this.cityID,
|
|
|
|
|
this.cityName,
|
|
|
|
|
this.demandAmount,
|
|
|
|
|
this.isActive,
|
|
|
|
|
this.isFinanceAvailable,
|
|
|
|
|
this.status,
|
|
|
|
|
this.statustext,
|
|
|
|
|
this.category,
|
|
|
|
|
this.color,
|
|
|
|
|
this.condition,
|
|
|
|
|
this.mileage,
|
|
|
|
|
this.model,
|
|
|
|
|
this.modelyear,
|
|
|
|
|
this.sellertype,
|
|
|
|
|
this.transmission,
|
|
|
|
|
this.duration,
|
|
|
|
|
this.image,
|
|
|
|
|
this.damagereport,
|
|
|
|
|
this.vehicleDescription,
|
|
|
|
|
this.vehicleTitle,
|
|
|
|
|
this.vehicleType,
|
|
|
|
|
this.vehicleVIN,
|
|
|
|
|
this.countryID,
|
|
|
|
|
this.currency});
|
|
|
|
|
|
|
|
|
|
Vehicle.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
cityID = json['cityID'];
|
|
|
|
|
cityName = json['cityName'];
|
|
|
|
|
demandAmount = json['demandAmount'];
|
|
|
|
|
isActive = json['isActive'];
|
|
|
|
|
isFinanceAvailable = json['isFinanceAvailable'];
|
|
|
|
|
status = json['status'];
|
|
|
|
|
statustext = json['statustext'];
|
|
|
|
|
category = json['category'] != null ? Category.fromJson(json['category']) : null;
|
|
|
|
|
color = json['color'] != null ? Category.fromJson(json['color']) : null;
|
|
|
|
|
condition = json['condition'] != null ? Condition.fromJson(json['condition']) : null;
|
|
|
|
|
mileage = json['mileage'] != null ? Mileage.fromJson(json['mileage']) : null;
|
|
|
|
|
model = json['model'] != null ? Condition.fromJson(json['model']) : null;
|
|
|
|
|
modelyear = json['modelyear'] != null ? ModelYear.fromJson(json['modelyear']) : null;
|
|
|
|
|
sellertype = json['sellertype'] != null ? Condition.fromJson(json['sellertype']) : null;
|
|
|
|
|
transmission = json['transmission'] != null ? Condition.fromJson(json['transmission']) : null;
|
|
|
|
|
duration = json['duration'] != null ? Duration.fromJson(json['duration']) : null;
|
|
|
|
|
if (json['image'] != null) {
|
|
|
|
|
image = <AdImage>[];
|
|
|
|
|
json['image'].forEach((v) {
|
|
|
|
|
image!.add(AdImage.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (json['damagereport'] != null) {
|
|
|
|
|
damagereport = <DamageReport>[];
|
|
|
|
|
json['damagereport'].forEach((v) {
|
|
|
|
|
damagereport!.add(DamageReport.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
vehicleDescription = json['vehicleDescription'];
|
|
|
|
|
vehicleTitle = json['vehicleTitle'];
|
|
|
|
|
vehicleType = json['vehicleType'];
|
|
|
|
|
vehicleVIN = json['vehicleVIN'];
|
|
|
|
|
countryID = json['countryID'];
|
|
|
|
|
currency = json['currency'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
|
data['id'] = id;
|
|
|
|
|
data['cityID'] = cityID;
|
|
|
|
|
data['cityName'] = cityName;
|
|
|
|
|
data['demandAmount'] = demandAmount;
|
|
|
|
|
data['isActive'] = isActive;
|
|
|
|
|
data['isFinanceAvailable'] = isFinanceAvailable;
|
|
|
|
|
data['status'] = status;
|
|
|
|
|
data['statustext'] = statustext;
|
|
|
|
|
if (category != null) {
|
|
|
|
|
data['category'] = category!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if (color != null) {
|
|
|
|
|
data['color'] = color!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if (condition != null) {
|
|
|
|
|
data['condition'] = condition!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if (mileage != null) {
|
|
|
|
|
data['mileage'] = mileage!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if (model != null) {
|
|
|
|
|
data['model'] = model!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if (modelyear != null) {
|
|
|
|
|
data['modelyear'] = modelyear!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if (sellertype != null) {
|
|
|
|
|
data['sellertype'] = sellertype!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if (transmission != null) {
|
|
|
|
|
data['transmission'] = transmission!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if (duration != null) {
|
|
|
|
|
data['duration'] = duration!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if (image != null) {
|
|
|
|
|
data['image'] = image!.map((v) => v.toJson()).toList();
|
|
|
|
|
}
|
|
|
|
|
if (damagereport != null) {
|
|
|
|
|
data['damagereport'] = damagereport!.map((v) => v.toJson()).toList();
|
|
|
|
|
}
|
|
|
|
|
data['vehicleDescription'] = vehicleDescription;
|
|
|
|
|
data['vehicleTitle'] = vehicleTitle;
|
|
|
|
|
data['vehicleType'] = vehicleType;
|
|
|
|
|
data['vehicleVIN'] = vehicleVIN;
|
|
|
|
|
data['countryID'] = countryID;
|
|
|
|
|
data['currency'] = currency;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Category {
|
|
|
|
|
int? id;
|
|
|
|
|
String? label;
|
|
|
|
|
String? labelN;
|
|
|
|
|
bool? isActive;
|
|
|
|
|
|
|
|
|
|
Category({this.id, this.label, this.labelN, this.isActive});
|
|
|
|
|
|
|
|
|
|
Category.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
label = json['label'];
|
|
|
|
|
labelN = json['labelN'];
|
|
|
|
|
isActive = json['isActive'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
|
data['id'] = id;
|
|
|
|
|
data['label'] = label;
|
|
|
|
|
data['labelN'] = labelN;
|
|
|
|
|
data['isActive'] = isActive;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Condition {
|
|
|
|
|
int? id;
|
|
|
|
|
String? label;
|
|
|
|
|
String? labelN;
|
|
|
|
|
|
|
|
|
|
Condition({this.id, this.label, this.labelN});
|
|
|
|
|
|
|
|
|
|
Condition.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
label = json['label'];
|
|
|
|
|
labelN = json['labelN'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
|
data['id'] = id;
|
|
|
|
|
data['label'] = label;
|
|
|
|
|
data['labelN'] = labelN;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Mileage {
|
|
|
|
|
int? id;
|
|
|
|
|
String? mileageStart;
|
|
|
|
|
String? mileageEnd;
|
|
|
|
|
String? label;
|
|
|
|
|
|
|
|
|
|
Mileage({this.id, this.mileageStart, this.mileageEnd, this.label});
|
|
|
|
|
|
|
|
|
|
Mileage.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
mileageStart = json['mileageStart'];
|
|
|
|
|
mileageEnd = json['mileageEnd'];
|
|
|
|
|
label = json['label'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
|
data['id'] = id;
|
|
|
|
|
data['mileageStart'] = mileageStart;
|
|
|
|
|
data['mileageEnd'] = mileageEnd;
|
|
|
|
|
data['label'] = label;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ModelYear {
|
|
|
|
|
int? id;
|
|
|
|
|
String? label;
|
|
|
|
|
|
|
|
|
|
ModelYear({this.id, this.label});
|
|
|
|
|
|
|
|
|
|
ModelYear.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
label = json['label'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
|
data['id'] = id;
|
|
|
|
|
data['label'] = label;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Duration {
|
|
|
|
|
int? id;
|
|
|
|
|
String? label;
|
|
|
|
|
int? days;
|
|
|
|
|
double? price;
|
|
|
|
|
ModelYear? country;
|
|
|
|
|
|
|
|
|
|
Duration({this.id, this.label, this.days, this.price, this.country});
|
|
|
|
|
|
|
|
|
|
Duration.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
label = json['label'];
|
|
|
|
|
days = json['days'];
|
|
|
|
|
price = json['price'];
|
|
|
|
|
country = json['country'] != null ? ModelYear.fromJson(json['country']) : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
|
data['id'] = id;
|
|
|
|
|
data['label'] = label;
|
|
|
|
|
data['days'] = days;
|
|
|
|
|
data['price'] = price;
|
|
|
|
|
if (country != null) {
|
|
|
|
|
data['country'] = country!.toJson();
|
|
|
|
|
}
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class AdImage {
|
|
|
|
|
int? id;
|
|
|
|
|
String? imageName;
|
|
|
|
|
String? imageUrl;
|
|
|
|
|
bool? isActive;
|
|
|
|
|
|
|
|
|
|
AdImage({this.id, this.imageName, this.imageUrl, this.isActive});
|
|
|
|
|
|
|
|
|
|
AdImage.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
imageName = json['imageName'];
|
|
|
|
|
imageUrl = json['imageUrl'];
|
|
|
|
|
isActive = json['isActive'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
|
data['id'] = id;
|
|
|
|
|
data['imageName'] = imageName;
|
|
|
|
|
data['imageUrl'] = imageUrl;
|
|
|
|
|
data['isActive'] = isActive;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class DamageReport {
|
|
|
|
|
int? id;
|
|
|
|
|
String? comment;
|
|
|
|
|
String? imageUrl;
|
|
|
|
|
bool? isActive;
|
|
|
|
|
int? vehicleDamagePartID;
|
|
|
|
|
String? partName;
|
|
|
|
|
|
|
|
|
|
DamageReport({this.id, this.comment, this.imageUrl, this.isActive, this.vehicleDamagePartID, this.partName});
|
|
|
|
|
|
|
|
|
|
DamageReport.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
comment = json['comment'];
|
|
|
|
|
imageUrl = json['imageUrl'];
|
|
|
|
|
isActive = json['isActive'];
|
|
|
|
|
vehicleDamagePartID = json['vehicleDamagePartID'];
|
|
|
|
|
partName = json['partName'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
|
data['id'] = id;
|
|
|
|
|
data['comment'] = comment;
|
|
|
|
|
data['imageUrl'] = imageUrl;
|
|
|
|
|
data['isActive'] = isActive;
|
|
|
|
|
data['vehicleDamagePartID'] = vehicleDamagePartID;
|
|
|
|
|
data['partName'] = partName;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|