import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/new_models/building.dart'; import 'package:test_sa/models/new_models/department.dart'; import 'package:test_sa/models/new_models/floor.dart'; import 'package:test_sa/models/new_models/site.dart'; class LoanFormModel { String? docName; String? docNumber; String? docEmail; String? itemDescription; String? requestDescription; String? model; String? manufacturer; Lookup? loanProvided; String? vendorName; String? vendorRepresentativeName; String? vendorNumber; String? vendorEmail; Site? site; Building? building; Lookup? department; Floor? floor; List? loanAttachment; LoanFormModel({ this.docName, this.docNumber, this.docEmail, this.itemDescription, this.requestDescription, this.model, this.manufacturer, this.loanProvided, this.vendorName, this.vendorRepresentativeName, this.vendorNumber, this.vendorEmail, this.loanAttachment, this.site, this.building, this.floor, this.department, }); Map toJson() { return { "docName": docName, "docNumber": docNumber, "docEmail": docEmail, "itemDescription": itemDescription, "requestDescription": requestDescription, "model": model, "manufacturer": manufacturer, "loanProvided": loanProvided?.toJson(), "vendorName": vendorName, "vendorRepresentativeName": vendorRepresentativeName, "vendorNumber": vendorNumber, "vendorEmail": vendorEmail, 'site' : site?.toJson(), 'building' : building?.toJson(), "loanAttachment": loanAttachment != null ? loanAttachment!.map((v) => v.toJson()).toList() : [], }; } } class LoanAttachments { LoanAttachments({ this.id, this.name, this.originalName, }); LoanAttachments.fromJson(dynamic json) { id = json['id']; name = json['name']; originalName = json['originalName']; } num? id; String? name; String? originalName; LoanAttachments copyWith({ num? id, // Parameter is now nullable String? name, // Parameter is now nullable String? originalName, // Parameter is now nullable }) => LoanAttachments( id: id ?? this.id, name: name ?? this.name, originalName: originalName ?? this.originalName, ); Map toJson() { final map = {}; map['id'] = id; map['name'] = name; map['originalName'] = originalName; return map; } }