import '../order/order_response.dart'; import '../order/service_order.dart'; import 'Address.dart'; class ServiceResult { ServiceResult({ this.id, this.withproduct, this.date, this.serviceduration, this.description, this.prioritys, this.amount, this.totalAmount, this.paymentMethod, this.requeststate, this.address, this.technician, this.service, this.timestamp, this.userPhoneNumber, this.driverState, this.technicianPaymentMethod, this.paymentState, this.receivedAmount, this.pos, // ----------- Missing attributes block ------------ this.archive, this.corporateEmail, this.corporateId, this.corporateName, this.corporatePhone, this.customername, this.customerphonenumber, this.imageURL, this.invoiced, this.payemmentType, this.propertyId, this.propertyName, this.propertyNameAr, this.quantity, this.reference, this.userName, this.useremail, this.technicienacceptdate, this.techniciencompletedate, this.subPropertiesIds, }); ServiceResult.fromJson(dynamic json) { if (json['requestItems'] != null) { requestItems = []; json['requestItems'].forEach((v) { requestItems?.add(RequestItem.fromJson(v)); }); } else { requestItems = []; } id = json['id']; withproduct = json['withproduct']; date = json['date']; serviceduration = json['serviceduration']; description = json['description']; prioritys = json['prioritys']; amount = json['amount']; totalAmount = json['totalAmount']; paymentMethod = json['paymentMethod']; requeststate = json['requeststate']; pos = json['pos']; receivedAmount = json['receivedAmount']; paymentState = json['paymentState']; technicianPaymentMethod = json['technicianPaymentMethod']; address = json['address'] != null ? Address.fromJson(json['address']) : null; technician = json['technician'] != null ? Technician.fromJson(json['technician']) : null; service = json['service'] != null ? ServiceOrder.fromJson(json['service']) : null; timestamp = json['timestamp']; userPhoneNumber = json['userPhoneNumber']; driverState = json['driverState']; /// ----------- Newly added missing attributes ------------ archive = json['archive']; corporateEmail = json['corporateEmail']; corporateId = json['corporateId']; corporateName = json['corporateName']; corporatePhone = json['corporatePhone']; customername = json['customername']; customerphonenumber = json['customerphonenumber']; imageURL = json['imageURL']; invoiced = json['invoiced']; payemmentType = json['payemmentType']; propertyId = json['propertyId']; propertyName = json['propertyName']; propertyNameAr = json['propertyNameAr']; quantity = json['quantity']; reference = json['reference']; userName = json['userName']; useremail = json['useremail']; technicienacceptdate = json['technicienacceptdate']; techniciencompletedate = json['techniciencompletedate']; subPropertiesIds = json['subPropertiesIds'] != null ? List.from(json['subPropertiesIds']) : []; } int? id; bool? withproduct; int? date; double? serviceduration; String? description; String? prioritys; double? amount; double? totalAmount; String? paymentMethod; String? requeststate; String? driverState; Address? address; Technician? technician; ServiceOrder? service; int? timestamp; String? userPhoneNumber; List? requestItems; String? technicianPaymentMethod; String? paymentState; double? receivedAmount; String? pos; //************************************** bool? archive; String? corporateEmail; int? corporateId; String? corporateName; String? corporatePhone; String? customername; String? customerphonenumber; String? imageURL; bool? invoiced; String? payemmentType; int? propertyId; String? propertyName; String? propertyNameAr; int? quantity; String? reference; String? userName; String? useremail; int? technicienacceptdate; int? techniciencompletedate; List? subPropertiesIds; Map toJson() { final map = {}; map['id'] = id; map['technicianPaymentMethod'] = technicianPaymentMethod; map['paymentState'] = paymentState; map['receivedAmount'] = receivedAmount; map['pos'] = pos; map['withproduct'] = withproduct; map['date'] = date; map['serviceduration'] = serviceduration; map['description'] = description; map['prioritys'] = prioritys; map['paymentMethod'] = paymentMethod; map['requeststate'] = requeststate; if (address != null) { map['address'] = address?.toJson(); } if (service != null) { map['service'] = service?.toJson(); } map['timestamp'] = timestamp; map['technician'] = technician?.toJson(); return map; } } class Technician { int id; int timestamp; int userId; String userName; String photoUrl; Technician({ required this.id, required this.timestamp, required this.userId, required this.userName, required this.photoUrl, }); factory Technician.fromJson(Map json) { return Technician( id: json['id'], timestamp: json['timestamp'], userId: json['userId'], userName: json['userName'], photoUrl: json['userURL'], ); } Map toJson() { return { 'id': id, 'timestamp': timestamp, 'userId': userId, 'userName': userName, 'userURL': photoUrl, }; } }