class Doctor {
  // Add achievements field
  List<String> achievements;

  // Add to existing fields
  String? speciality;
  String? yearsOfExperience;
  String? licenseNumber;
  String? profileDescription;
  String? digitalSignature;
  Address address;
  Profile profile;

  Doctor({
    this.achievements = const [], // Initialize with empty list
    this.speciality,
    this.yearsOfExperience,
    this.licenseNumber,
    this.profileDescription,
    this.digitalSignature,
    required this.address,
    required this.profile,
  });

  Map<String, dynamic> toJson() => {
        'achievements': achievements,
        'speciality': speciality,
        'yearsOfExperience': yearsOfExperience,
        'licenseNumber': licenseNumber,
        'profileDescription': profileDescription,
        'digitalSignature': digitalSignature,
        'address': address.toJson(),
        'profile': profile.toJson(),
      };

  static Doctor fromJson(Map<String, dynamic> json) => Doctor(
        achievements: List<String>.from(json['achievements'] ?? []),
        speciality: json['speciality'],
        yearsOfExperience: json['yearsOfExperience'],
        licenseNumber: json['licenseNumber'],
        profileDescription: json['profileDescription'],
        digitalSignature: json['digitalSignature'],
        address: Address.fromJson(json['address']),
        profile: Profile.fromJson(json['profile']),
      );
}

class Profile {
  String? title;
  String? surName;
  String? middleName;
  String? lastName;
  List<String> qualifications;

  String? profileDescription;

  Profile({
    this.title,
    this.surName,
    this.middleName,
    this.lastName,
    required this.qualifications,
  });

  Map<String, dynamic> toJson() => {
        'title': title,
        'surname': surName,
        'lastName': lastName,
        'middleName': middleName,
        'qualifications': qualifications,
      };

  static Profile fromJson(Map<String, dynamic> json) => Profile(
        title: json['title'],
        surName: json['surname'],
        middleName: json['middleName'],
        lastName: json['lastName'],
        qualifications: List<String>.from(json['qualifications']),
      );
}

class Address {
  String? floorBuilding;
  String? street;
  String? city;
  String? state;
  String? country;
  String? postalCode;

  Address({
    this.floorBuilding,
    this.street,
    this.city,
    this.state,
    this.country,
    this.postalCode,
  });

  Map<String, dynamic> toJson() => {
        'floorBuilding': floorBuilding,
        'street': street,
        'city': city,
        'state': state,
        'country': country,
        'postalCode': postalCode,
      };

  static Address fromJson(Map<String, dynamic> json) => Address(
        floorBuilding: json['floorBuilding'],
        street: json['street'],
        city: json['city'],
        state: json['state'],
        country: json['country'],
        postalCode: json['postalCode'],
      );
}
