import 'dart:io'; import 'package:mc_common_app/utils/utils.dart'; class GenericRespModel { GenericRespModel({ this.data, this.messageStatus, this.totalItemsCount, this.message, }); dynamic data; int? messageStatus; int? totalItemsCount; String? message; factory GenericRespModel.fromJson(Map json) { if (json.containsKey('StatusMessage')) { if ((json['StatusMessage'] as String).contains('Internal server error')) { Utils.showToast("${json['StatusMessage']}"); } } return GenericRespModel( data: json["data"], messageStatus: json["messageStatus"], totalItemsCount: json["totalItemsCount"], message: json["message"], ); } Map toJson() => { "data": data, "messageStatus": messageStatus, "totalItemsCount": totalItemsCount, "message": message, }; } class AdsCreationPayloadModel { Ads? ads; VehiclePosting? vehiclePosting; AdsCreationPayloadModel({this.ads, this.vehiclePosting}); AdsCreationPayloadModel.fromJson(Map json) { ads = json['ads'] != null ? Ads.fromJson(json['ads']) : null; vehiclePosting = json['vehiclePosting'] != null ? VehiclePosting.fromJson(json['vehiclePosting']) : null; } } class Ads { int? id; int? adsDurationID; String? startDate; int? countryId; List? specialServiceIDs; bool? isMCHandled; bool? showContactDetail; bool? isOnWhatsApp; Ads({ this.id, this.adsDurationID, this.startDate, this.countryId, this.specialServiceIDs, this.isMCHandled, this.showContactDetail, this.isOnWhatsApp, }); Ads.fromJson(Map json) { id = json['id']; adsDurationID = json['adsDurationID']; startDate = json['startDate']; countryId = json['countryId']; specialServiceIDs = json['specialServiceIDs'].cast(); isMCHandled = json['isMCHandled']; showContactDetail = json['showContactDetail']; isOnWhatsApp = json['isOnWhatsApp']; } Map toJson() { final Map data = {}; data['id'] = id; data['adsDurationID'] = adsDurationID; data['startDate'] = startDate; data['countryId'] = countryId; data['specialServiceIDs'] = specialServiceIDs; data['isMCHandled'] = isMCHandled; return data; } @override String toString() { return 'Ads{id: $id, adsDurationID: $adsDurationID, startDate: $startDate, countryId: $countryId, specialServiceIDs: $specialServiceIDs, isMCHandled: $isMCHandled}'; } } class VehiclePosting { int? id; String? userID; int? vehicleType; int? vehicleModelID; int? vehicleModelYearID; int? vehicleColorID; int? vehicleCategoryID; int? vehicleConditionID; int? vehicleMileageID; int? vehicleTransmissionID; int? vehicleSellerTypeID; int? cityID; int? price; String? vehicleVIN; String? vehicleDescription; String? vehicleTitle; String? vehicleDescriptionN; bool? isFinanceAvailable; int? warantyYears; int? demandAmount; int? adStatus; List? vehiclePostingImages; List? vehiclePostingDamageParts; String? phoneNo; String? whatsAppNo; VehiclePosting({ this.id, this.userID, this.vehicleType, this.vehicleModelID, this.vehicleModelYearID, this.vehicleColorID, this.vehicleCategoryID, this.vehicleConditionID, this.vehicleMileageID, this.vehicleTransmissionID, this.vehicleSellerTypeID, this.cityID, this.price, this.vehicleVIN, this.vehicleDescription, this.vehicleTitle, this.vehicleDescriptionN, this.isFinanceAvailable, this.warantyYears, this.demandAmount, this.adStatus, this.phoneNo, this.whatsAppNo, this.vehiclePostingImages, this.vehiclePostingDamageParts, }); VehiclePosting.fromJson(Map json) { id = json['id']; userID = json['userID']; vehicleType = json['vehicleType']; vehicleModelID = json['vehicleModelID']; vehicleModelYearID = json['vehicleModelYearID']; vehicleColorID = json['vehicleColorID']; vehicleCategoryID = json['vehicleCategoryID']; vehicleConditionID = json['vehicleConditionID']; vehicleMileageID = json['vehicleMileageID']; vehicleTransmissionID = json['vehicleTransmissionID']; vehicleSellerTypeID = json['vehicleSellerTypeID']; cityID = json['cityID']; price = json['price']; vehicleVIN = json['vehicleVIN']; vehicleDescription = json['vehicleDescription']; vehicleTitle = json['vehicleTitle']; vehicleDescriptionN = json['vehicleDescriptionN']; isFinanceAvailable = json['isFinanceAvailable']; warantyYears = json['warantyYears']; demandAmount = json['demandAmount']; adStatus = json['adStatus']; phoneNo = json['phoneNo']; whatsAppNo = json['whatsAppNo']; if (json['vehiclePostingImages'] != null) { vehiclePostingImages = []; json['vehiclePostingImages'].forEach((v) { vehiclePostingImages!.add(VehiclePostingImages.fromJson(v)); }); } if (json['vehiclePostingDamageParts'] != null) { vehiclePostingDamageParts = []; json['vehiclePostingDamageParts'].forEach((v) { vehiclePostingDamageParts!.add(VehiclePostingDamageParts.fromJson(v)); }); } } @override String toString() { return 'VehiclePosting{id: $id, userID: $userID, vehicleType: $vehicleType, vehicleModelID: $vehicleModelID, vehicleModelYearID: $vehicleModelYearID, vehicleColorID: $vehicleColorID, vehicleCategoryID: $vehicleCategoryID, vehicleConditionID: $vehicleConditionID, vehicleMileageID: $vehicleMileageID, vehicleTransmissionID: $vehicleTransmissionID, vehicleSellerTypeID: $vehicleSellerTypeID, cityID: $cityID, price: $price, vehicleVIN: $vehicleVIN, vehicleDescription: $vehicleDescription, vehicleTitle: $vehicleTitle, vehicleDescriptionN: $vehicleDescriptionN, isFinanceAvailable: $isFinanceAvailable, warantyYears: $warantyYears, demandAmount: $demandAmount, adStatus: $adStatus, vehiclePostingImages: $vehiclePostingImages, vehiclePostingDamageParts: $vehiclePostingDamageParts, phoneNo: $phoneNo, whatsAppNo: $whatsAppNo}'; } } class VehiclePostingImages { int? id; File? file; String? imageName; String? imageUrl; String? imageStr; int? vehiclePostingID; String? vehiclePosting; VehiclePostingImages({this.id, this.file, this.imageName, this.imageUrl, this.imageStr, this.vehiclePostingID, this.vehiclePosting}); VehiclePostingImages.fromJson(Map json) { id = json['id']; file = null; imageName = json['imageName']; imageUrl = json['imageUrl']; imageStr = json['imageStr']; vehiclePostingID = json['vehiclePostingID']; vehiclePosting = json['vehiclePosting']; } Map toJson() { final Map data = {}; data['id'] = id; data['imageName'] = imageName; data['imageUrl'] = imageUrl; data['imageStr'] = imageStr; data['vehiclePostingID'] = vehiclePostingID; data['vehiclePosting'] = vehiclePosting; return data; } @override String toString() { return 'VehiclePostingImages{id: $id, imageName: $imageName, imageUrl: $imageUrl, imageStr: "", vehiclePostingID: $vehiclePostingID, vehiclePosting: $vehiclePosting}'; } } class RequestPostingImages { int? id; String? requestImage; int? requestID; RequestPostingImages({this.id, this.requestImage, this.requestID}); RequestPostingImages.fromJson(Map json) { id = json['id']; requestImage = json['requestImage']; requestID = json['requestID']; } Map toJson() { final Map data = {}; data['id'] = id ?? 0; data['requestImage'] = requestImage; data['requestID'] = requestID ?? 0; return data; } @override String toString() { return 'RequestPostingImages{id: $id, requestImage: $requestImage, requestID: $requestID}'; } } class VehiclePostingDamageParts { int? id; File? file; String? comment; String? imageUrl; String? vehicleImageBase64; int? vehicleDamagePartID; int? vehiclePostingID; bool? isActive; VehiclePostingDamageParts({this.id, this.file, this.comment, this.imageUrl, this.vehicleImageBase64, this.vehicleDamagePartID, this.vehiclePostingID, this.isActive}); VehiclePostingDamageParts.fromJson(Map json) { id = json['id']; file = null; comment = json['comment']; imageUrl = json['imageUrl']; vehicleImageBase64 = json['vehicleImageBase64']; vehicleDamagePartID = json['vehicleDamagePartID']; vehiclePostingID = json['vehiclePostingID']; isActive = json['isActive']; } Map toJson() { final Map data = {}; data['id'] = id; data['comment'] = comment; data['imageUrl'] = imageUrl; data['vehicleImageBase64'] = vehicleImageBase64; data['vehicleDamagePartID'] = vehicleDamagePartID; data['vehiclePostingID'] = vehiclePostingID; data['isActive'] = isActive; return data; } @override String toString() { return 'VehiclePostingDamageParts{id: $id, comment: $comment, vehicleImageBase64: $vehicleImageBase64, vehicleDamagePartID: $vehicleDamagePartID, vehiclePostingID: $vehiclePostingID, isActive: $isActive}'; } } class BranchPostingImages { int? id; String? imageName; String? imageUrl; String? imageStr; BranchPostingImages({this.id, this.imageName, this.imageUrl, this.imageStr}); BranchPostingImages.fromJson(Map json) { id = json['id']; imageName = json['imageName']; imageUrl = json['imageUrl']; imageStr = json['imageStr']; } }