import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/new_models/mapped_sites.dart';
import 'package:test_sa/models/new_models/site.dart';
import 'package:test_sa/models/new_models/traf_department.dart';
import 'package:test_sa/models/service_request/supp_engineer_work_orders.dart';
import 'package:test_sa/models/service_request/supplier_details.dart';
import 'package:test_sa/modules/loan_module/models/medical_department_model.dart';

class LoanFormModel {
  String? docName;
  String? docNumber;
  String? docEmail;
  String? itemDescription;
  String? requestDescription;
  String? model;
  String? manufacturer;
  bool isNewVendor;
  Lookup? loanProvided;
  String? vendorName;
  String? vendorRepresentativeName;
  String? vendorNumber;
  String? vendorEmail;
  Site? site;
  SupplierDetails? supplier;
  SuppEngineerWorkOrders? supEngineer;
  MedicalDepartmentModel? department;
  List<GenericAttachmentModel>? loanAttachment;
  MappedSite? mappedSite;
  TrafDepartment? mappedDepartment;

  LoanFormModel({
    this.docName,
    this.isNewVendor = false,
    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.supplier,
    this.supEngineer,
    this.department,
    this.mappedSite,
    this.mappedDepartment,
  });


  Map<String, dynamic> toJson() {
    return {
      "doctorName": docName,
      "doctorContact": docNumber,
      "doctorEmail": docEmail,
      "itemDescription": itemDescription,
      "requestDescription": requestDescription,
      "model": model,
      "manufacturer": manufacturer,
      "loanPeriodId": loanProvided?.id,
      "vendorName": vendorName,
      "vendorRepresentativeName": vendorRepresentativeName,
      "vendorRepName": vendorRepresentativeName,
      "vendorNumber": vendorNumber,
      "vendorContact": vendorNumber,
      "vendorEmail": vendorEmail,
      "isNewVendor": isNewVendor,
      'siteId': mappedSite?.id,
      'departmentId': mappedDepartment?.id,
      "loanAttachments": loanAttachment != null ? loanAttachment!.map((v) => v.toLoanJson()).toList() : [],
    };
  }
}

