import 'package:test_sa/models/new_models/assigned_employee.dart'; import '../device/asset.dart'; import '../lookup.dart'; import 'call_site_contact_person.dart'; class CallRequest { CallRequest({ this.id, this.callNo, this.callComments, this.asset, this.assignedEmployee, this.callSiteContactPerson, this.status, this.callLastSituation, this.defectType, this.firstAction, this.loanAvailablity, this.assetLoan, this.assetType, }); CallRequest.fromJson(dynamic json) { id = json['id']; callNo = json['callNo']; callComments = json['callComments']; asset = json['asset'] != null ? Asset.fromJson(json['asset']) : null; assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null; if (json['callSiteContactPerson'] != null) { callSiteContactPerson = []; json['callSiteContactPerson'].forEach((v) { callSiteContactPerson.add(CallSiteContactPerson.fromJson(v)); }); } status = json['status'] != null ? Lookup.fromJson(json['status']) : null; callLastSituation = json['callLastSituation'] != null ? Lookup.fromJson(json['callLastSituation']) : null; defectType = json['defectType'] != null ? Lookup.fromJson(json['defectType']) : null; firstAction = json['firstAction'] != null ? Lookup.fromJson(json['firstAction']) : null; loanAvailablity = json['loanAvailablity'] != null ? Lookup.fromJson(json['loanAvailablity']) : null; assetLoan = json['assetLoan'] != null ? AssetInfo.fromJson(json['assetLoan']) : null; assetType = json['assetType']; } num id; String callNo; String callComments; Asset asset; AssignedEmployee assignedEmployee; List callSiteContactPerson; Lookup status; Lookup callLastSituation; Lookup defectType; Lookup firstAction; Lookup loanAvailablity; AssetInfo assetLoan; num assetType; CallRequest copyWith({ num id, String callNo, String callComments, Asset asset, AssignedEmployee assignedEmployee, List callSiteContactPerson, Lookup status, Lookup callLastSituation, Lookup defectType, Lookup firstAction, Lookup loanAvailablity, AssetInfo assetLoan, num assetType, }) => CallRequest( id: id ?? this.id, callNo: callNo ?? this.callNo, callComments: callComments ?? this.callComments, asset: asset ?? this.asset, assignedEmployee: assignedEmployee ?? this.assignedEmployee, callSiteContactPerson: callSiteContactPerson ?? this.callSiteContactPerson, status: status ?? this.status, callLastSituation: callLastSituation ?? this.callLastSituation, defectType: defectType ?? this.defectType, firstAction: firstAction ?? this.firstAction, loanAvailablity: loanAvailablity ?? this.loanAvailablity, assetLoan: assetLoan ?? this.assetLoan, assetType: assetType ?? this.assetType, ); Map toJson() { final map = {}; map['id'] = id; map['callNo'] = callNo; map['callComments'] = callComments; if (asset != null) { map['asset'] = asset.toJson(); } if (assignedEmployee != null) { map['assignedEmployee'] = assignedEmployee.toJson(); } if (callSiteContactPerson != null) { map['callSiteContactPerson'] = callSiteContactPerson.map((v) => v.toJson()).toList(); } if (status != null) { map['status'] = status.toJson(); } if (callLastSituation != null) { map['callLastSituation'] = callLastSituation.toJson(); } if (defectType != null) { map['defectType'] = defectType.toJson(); } if (firstAction != null) { map['firstAction'] = firstAction.toJson(); } if (loanAvailablity != null) { map['loanAvailablity'] = loanAvailablity.toJson(); } if (assetLoan != null) { map['assetLoan'] = assetLoan.toJson(); } map['assetType'] = assetType; return map; } }