class ApporvalDetails {
  int approvalNo;

  String procedureName;
  //String procedureNameN;
  String status;

  String isInvoicedDesc;

  ApporvalDetails(
      {this.approvalNo, this.procedureName, this.status, this.isInvoicedDesc});

  ApporvalDetails.fromJson(Map<String, dynamic> json) {
    approvalNo = json['ApprovalNo'];

    procedureName = json['ProcedureName'];

    status = json['Status'];

    isInvoicedDesc = json['IsInvoicedDesc'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();

    data['ApprovalNo'] = this.approvalNo;

    data['ProcedureName'] = this.procedureName;

    data['Status'] = this.status;

    data['IsInvoicedDesc'] = this.isInvoicedDesc;
    return data;
  }
}

class InsuranceApprovalModel {
  List<ApporvalDetails> apporvalDetails;
  double versionID;
  int channel;
  int languageID;
  String iPAdress;
  String generalid;
  int patientOutSA;
  String sessionID;
  bool isDentalAllowedBackend;
  int deviceTypeID;
  int patientID;
  String tokenID;
  int patientTypeID;
  int patientType;
  int eXuldAPPNO;
  int projectID;
  String doctorName;
  String clinicName;
  String patientDescription;
  int approvalNo;
  String approvalStatusDescption;
  int unUsedCount;
  String doctorImage;
  String projectName;

  //String companyName;
  String expiryDate;
  String rceiptOn;
  int appointmentNo;

  InsuranceApprovalModel(
      {this.versionID,
      this.channel,
      this.languageID,
      this.iPAdress,
      this.generalid,
      this.patientOutSA,
      this.sessionID,
      this.isDentalAllowedBackend,
      this.deviceTypeID,
      this.patientID,
      this.tokenID,
      this.patientTypeID,
      this.patientType,
      this.eXuldAPPNO,
      this.projectID,
      this.doctorName,
      this.clinicName,
      this.patientDescription,
      this.approvalNo,
      this.approvalStatusDescption,
      this.unUsedCount,
      //this.companyName,
      this.expiryDate,
      this.rceiptOn,
      this.apporvalDetails,
      this.appointmentNo,
      this.doctorImage,
      this.projectName});

  //InsuranceApprovalDetails x = InsuranceApprovalDetails();

  InsuranceApprovalModel.fromJson(Map<String, dynamic> json) {
    try {
      rceiptOn = json['ReceiptOn'];
      expiryDate = json['ExpiryDate'];
      //companyName = json['CompanyName'];
      unUsedCount = json['TotaUnUsedCount'];
      approvalStatusDescption = json['ApprovalStatusDescption'];
      approvalNo = json['ApprovalNo'];
      patientDescription = json['IsInOutPatientDescription'];
      versionID = json['VersionID'];
      channel = json['Channel'];
      languageID = json['LanguageID'];
      iPAdress = json['IPAdress'];
      generalid = json['generalid'];
      patientOutSA = json['PatientOutSA'];
      sessionID = json['SessionID'];
      isDentalAllowedBackend = json['isDentalAllowedBackend'];
      deviceTypeID = json['DeviceTypeID'];
      patientID = json['PatientID'];
      tokenID = json['TokenID'];
      projectName = json['ProjectName'];
      patientTypeID = json['PatientTypeID'];
      patientType = json['PatientType'];
      eXuldAPPNO = json['EXuldAPPNO'];
      projectID = json['ProjectID'];
      doctorName = json['DoctorName'];
      doctorImage = json['DoctorImageURL'];
      clinicName = json['ClinicName'];
      if (json['ApporvalDetails'] != null) {
        apporvalDetails = new List<ApporvalDetails>();
        json['ApporvalDetails'].forEach((v) {
          apporvalDetails.add(new ApporvalDetails.fromJson(v));
        });
      }
      appointmentNo = json['AppointmentNo'];
    } catch (e) {
      print(e);
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['VersionID'] = this.versionID;
    data['Channel'] = this.channel;
    data['LanguageID'] = this.languageID;
    data['IPAdress'] = this.iPAdress;
    data['generalid'] = this.generalid;
    data['PatientOutSA'] = this.patientOutSA;
    data['SessionID'] = this.sessionID;
    data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
    data['DeviceTypeID'] = this.deviceTypeID;
    data['PatientID'] = this.patientID;
    data['TokenID'] = this.tokenID;
    data['DoctorImageURL'] = this.doctorImage;
    data['ProjectName'] = this.projectName;

    data['PatientTypeID'] = this.patientTypeID;
    data['PatientType'] = this.patientType;
    if (appointmentNo == null) {
      data['EXuldAPPNO'] = this.eXuldAPPNO;
      data['ProjectID'] = this.projectID;
    }
    if (appointmentNo != null) {
      data['AppointmentNo'] = this.appointmentNo;
    }
    return data;
  }
}

// class InsuranceApprovalModel {
//   String setupID;
//   int projectID;
//   int approvalNo;
//   String approvalDate;
//   int patientType;
//   int patientID;
//   int companyID;
//   int subCategoryID;
//   int doctorID;
//   int clinicID;
//   int approvalType;
//   Null inpatientApprovalSubType;
//   String validFrom;
//   Null vaildDays;
//   String validTo;
//   Null isApprovalOnGross;
//   Null isPackage;
//   int requestedAmount;
//   bool isDentalAllowedBackend;
//   int patientTypeID;
//
//   String companyApprovalNo;
//
//   String submitOn;
//   String receiptOn;
//
//   int status;
//   int eXuldAPPNO;
//   String feedbackStatusOn;
//   int authorizerID;
//   String expiryDate;
//   int appointmentNo;
//   int admissionNo;
//
//   int createdBy;
//   String createdOn;
//   int editedBy;
//   String editedOn;
//
//   String extendedOn;
//
//   int noOrderAuthorizerID;
//   bool isVerbalApproval;
//
//   List<ApporvalDetails> apporvalDetails;
//   String approvalStatusDescption;
//   String clinicName;
//
//   //Null companyName;
//   String doctorImageURL;
//   String doctorName;
//
//   int doctorRate;
//   String doctorTitle;
//   int gender;
//   String genderDescription;
//   bool isActiveDoctorProfile;
//   bool isExecludeDoctor;
//   bool isInOutPatient;
//   String isInOutPatientDescription;
//   String isInOutPatientDescriptionN;
//   bool isLiveCareAppointment;
//   String projectName;
//
//   String qR;
//   List<String> speciality;
//
//   int totaUnUsedCount;
//   int unUsedCount;
//
//   InsuranceApprovalModel(
//       {this.setupID,
//       this.projectID,
//       this.approvalNo,
//       this.approvalDate,
//       this.patientType,
//       this.patientID,
//       this.companyID,
//       this.subCategoryID,
//       this.doctorID,
//       this.clinicID,
//       this.approvalType,
//       this.inpatientApprovalSubType,
//       this.validFrom,
//       this.vaildDays,
//       this.validTo,
//       this.isApprovalOnGross,
//       this.isPackage,
//       this.requestedAmount,
//       this.patientTypeID,
//       this.companyApprovalNo,
//       this.eXuldAPPNO,
//       this.submitOn,
//       this.receiptOn,
//       this.status,
//       this.feedbackStatusOn,
//       this.authorizerID,
//       this.expiryDate,
//       this.appointmentNo,
//       this.admissionNo,
//       this.createdBy,
//       this.createdOn,
//       this.editedBy,
//       this.editedOn,
//       this.extendedOn,
//       this.noOrderAuthorizerID,
//       this.isVerbalApproval,
//       this.apporvalDetails,
//       this.approvalStatusDescption,
//       this.clinicName,
//       this.doctorImageURL,
//       this.doctorName,
//       this.doctorRate,
//       this.doctorTitle,
//       this.gender,
//       this.genderDescription,
//       this.isActiveDoctorProfile,
//       this.isExecludeDoctor,
//       this.isInOutPatient,
//       this.isInOutPatientDescription,
//       this.isInOutPatientDescriptionN,
//       this.isLiveCareAppointment,
//       this.projectName,
//       this.qR,
//       this.speciality,
//       this.totaUnUsedCount,
//       this.unUsedCount,
//       this.isDentalAllowedBackend});
//
//   InsuranceApprovalModel.fromJson(Map<String, dynamic> json) {
//     eXuldAPPNO = json['EXuldAPPNO'];
//     setupID = json['SetupID'];
//     projectID = json['ProjectID'];
//     approvalNo = json['ApprovalNo'];
//     approvalDate = json['ApprovalDate'];
//     patientType = json['PatientType'];
//     patientID = json['PatientID'];
//     companyID = json['CompanyID'];
//     subCategoryID = json['SubCategoryID'];
//     doctorID = json['DoctorID'];
//     clinicID = json['ClinicID'];
//     approvalType = json['ApprovalType'];
//     inpatientApprovalSubType = json['InpatientApprovalSubType'];
//     validFrom = json['ValidFrom'];
//     vaildDays = json['VaildDays'];
//     validTo = json['ValidTo'];
//     isApprovalOnGross = json['IsApprovalOnGross'];
//     isPackage = json['IsPackage'];
//     requestedAmount = json['RequestedAmount'];
//
//     companyApprovalNo = json['CompanyApprovalNo'];
//
//     submitOn = json['SubmitOn'];
//     receiptOn = json['ReceiptOn'];
//
//     status = json['Status'];
//
//     feedbackStatusOn = json['FeedbackStatusOn'];
//     authorizerID = json['AuthorizerID'];
//     expiryDate = json['ExpiryDate'];
//     appointmentNo = json['AppointmentNo'];
//     admissionNo = json['AdmissionNo'];
//
//     createdBy = json['CreatedBy'];
//     createdOn = json['CreatedOn'];
//     editedBy = json['EditedBy'];
//     editedOn = json['EditedOn'];
//
//     extendedOn = json['ExtendedOn'];
//
//     noOrderAuthorizerID = json['NoOrderAuthorizerID'];
//     isVerbalApproval = json['isVerbalApproval'];
//
//     if (json['ApporvalDetails'] != null) {
//       apporvalDetails = new List<ApporvalDetails>();
//       json['ApporvalDetails'].forEach((v) {
//         apporvalDetails.add(new ApporvalDetails.fromJson(v));
//       });
//     }
//     approvalStatusDescption = json['ApprovalStatusDescption'];
//     clinicName = json['ClinicName'];
//
//     doctorImageURL = json['DoctorImageURL'];
//     doctorName = json['DoctorName'];
//
//     doctorRate = json['DoctorRate'];
//     doctorTitle = json['DoctorTitle'];
//     gender = json['Gender'];
//     genderDescription = json['GenderDescription'];
//     isActiveDoctorProfile = json['IsActiveDoctorProfile'];
//     isExecludeDoctor = json['IsExecludeDoctor'];
//     isInOutPatient = json['IsInOutPatient'];
//     isInOutPatientDescription = json['IsInOutPatientDescription'];
//     isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN'];
//     isLiveCareAppointment = json['IsLiveCareAppointment'];
//     projectName = json['ProjectName'];
//
//     qR = json['QR'];
//     speciality = json['Speciality'].cast<String>();
//
//     totaUnUsedCount = json['TotaUnUsedCount'];
//     unUsedCount = json['UnUsedCount'];
//   }
//
//   Map<String, dynamic> toJson() {
//     final Map<String, dynamic> data = new Map<String, dynamic>();
//     data['SetupID'] = this.setupID;
//     data['ProjectID'] = this.projectID;
//     data['ApprovalNo'] = this.approvalNo;
//     data['ApprovalDate'] = this.approvalDate;
//     data['PatientType'] = this.patientType;
//     data['PatientID'] = this.patientID;
//     data['CompanyID'] = this.companyID;
//     data['SubCategoryID'] = this.subCategoryID;
//     data['DoctorID'] = this.doctorID;
//     data['ClinicID'] = this.clinicID;
//     data['ApprovalType'] = this.approvalType;
//     data['InpatientApprovalSubType'] = this.inpatientApprovalSubType;
//     data['ValidFrom'] = this.validFrom;
//     data['VaildDays'] = this.vaildDays;
//     data['ValidTo'] = this.validTo;
//     data['IsApprovalOnGross'] = this.isApprovalOnGross;
//     data['IsPackage'] = this.isPackage;
//     data['RequestedAmount'] = this.requestedAmount;
//
//     data['CompanyApprovalNo'] = this.companyApprovalNo;
//
//     data['SubmitOn'] = this.submitOn;
//     data['ReceiptOn'] = this.receiptOn;
//
//     data['Status'] = this.status;
//
//     data['FeedbackStatusOn'] = this.feedbackStatusOn;
//     data['AuthorizerID'] = this.authorizerID;
//     data['ExpiryDate'] = this.expiryDate;
//     data['AppointmentNo'] = this.appointmentNo;
//     data['AdmissionNo'] = this.admissionNo;
//
//     data['CreatedBy'] = this.createdBy;
//     data['CreatedOn'] = this.createdOn;
//     data['EditedBy'] = this.editedBy;
//     data['EditedOn'] = this.editedOn;
//     data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
//
//     data['ExtendedOn'] = this.extendedOn;
//
//     data['NoOrderAuthorizerID'] = this.noOrderAuthorizerID;
//     data['isVerbalApproval'] = this.isVerbalApproval;
//
//     if (this.apporvalDetails != null) {
//       data['ApporvalDetails'] =
//           this.apporvalDetails.map((v) => v.toJson()).toList();
//     }
//     data['ApprovalStatusDescption'] = this.approvalStatusDescption;
//     data['ClinicName'] = this.clinicName;
//
//     data['DoctorImageURL'] = this.doctorImageURL;
//     data['DoctorName'] = this.doctorName;
//     data['EXuldAPPNO'] = this.eXuldAPPNO;
//     data['DoctorRate'] = this.doctorRate;
//     data['DoctorTitle'] = this.doctorTitle;
//     data['Gender'] = this.gender;
//     data['GenderDescription'] = this.genderDescription;
//     data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile;
//     data['IsExecludeDoctor'] = this.isExecludeDoctor;
//     data['IsInOutPatient'] = this.isInOutPatient;
//     data['IsInOutPatientDescription'] = this.isInOutPatientDescription;
//     data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN;
//     data['IsLiveCareAppointment'] = this.isLiveCareAppointment;
//     data['ProjectName'] = this.projectName;
//
//     data['QR'] = this.qR;
//     data['Speciality'] = this.speciality;
//
//     data['TotaUnUsedCount'] = this.totaUnUsedCount;
//     data['UnUsedCount'] = this.unUsedCount;
//     return data;
//   }
// }
//
// class ApporvalDetails {
//   int approvalNo;
//
//   String procedureName;
//   //String procedureNameN;
//   String status;
//
//   String isInvoicedDesc;
//
//   ApporvalDetails(
//       {this.approvalNo, this.procedureName, this.status, this.isInvoicedDesc});
//
//   ApporvalDetails.fromJson(Map<String, dynamic> json) {
//     approvalNo = json['ApprovalNo'];
//
//     procedureName = json['ProcedureName'];
//
//     status = json['Status'];
//
//     isInvoicedDesc = json['IsInvoicedDesc'];
//   }
//
//   Map<String, dynamic> toJson() {
//     final Map<String, dynamic> data = new Map<String, dynamic>();
//
//     data['ApprovalNo'] = this.approvalNo;
//
//     data['ProcedureName'] = this.procedureName;
//
//     data['Status'] = this.status;
//
//     data['IsInvoicedDesc'] = this.isInvoicedDesc;
//     return data;
//   }
// }
