class PrescriptionAnalysisResponse {
  String? prescriptionSummary;
  List<MedicineAnalysis>? medicinesAnalysis;
  List<String>? importantWarnings;
  List<String>? medicineInteractions;
  String? followUpNeeded;
  int? languageId;

  PrescriptionAnalysisResponse({
    this.prescriptionSummary,
    this.medicinesAnalysis,
    this.importantWarnings,
    this.medicineInteractions,
    this.followUpNeeded,
    this.languageId,
  });

  PrescriptionAnalysisResponse.fromJson(Map<String, dynamic> json) {
    prescriptionSummary = json['prescription_summary'];
    if (json['medicines_analysis'] != null) {
      medicinesAnalysis = <MedicineAnalysis>[];
      json['medicines_analysis'].forEach((v) {
        medicinesAnalysis!.add(MedicineAnalysis.fromJson(v));
      });
    }
    importantWarnings = json['important_warnings'] != null ? json['important_warnings'].cast<String>() : [];
    medicineInteractions = json['medicine_interactions'] != null ? json['medicine_interactions'].cast<String>() : [];
    followUpNeeded = json['follow_up_needed'];
    languageId = json['language_id'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['prescription_summary'] = prescriptionSummary;
    if (medicinesAnalysis != null) {
      data['medicines_analysis'] = medicinesAnalysis!.map((v) => v.toJson()).toList();
    }
    data['important_warnings'] = importantWarnings;
    data['medicine_interactions'] = medicineInteractions;
    data['follow_up_needed'] = followUpNeeded;
    data['language_id'] = languageId;
    return data;
  }
}

class MedicineAnalysis {
  String? medicineName;
  String? benefit;
  List<String>? commonSideEffects;
  List<String>? seriousWarnings;
  String? storage;

  MedicineAnalysis({
    this.medicineName,
    this.benefit,
    this.commonSideEffects,
    this.seriousWarnings,
    this.storage,
  });

  MedicineAnalysis.fromJson(Map<String, dynamic> json) {
    medicineName = json['medicine_name'];
    benefit = json['benefit'];
    commonSideEffects = json['common_side_effects'] != null ? json['common_side_effects'].cast<String>() : [];
    seriousWarnings = json['serious_warnings'] != null ? json['serious_warnings'].cast<String>() : [];
    storage = json['storage'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['medicine_name'] = medicineName;
    data['benefit'] = benefit;
    data['common_side_effects'] = commonSideEffects;
    data['serious_warnings'] = seriousWarnings;
    data['storage'] = storage;
    return data;
  }
}

