import 'package:telemednet/data/models/doctor.dart';

class DoctorController {
  Doctor model = Doctor(
    address: Address(floorBuilding: ''),
    profile: Profile(qualifications: []),
  );

  final ProfileController profileController = ProfileController();
  final AddressController addressController = AddressController();

  // Doctor Specific Updates
  void updateSpeciality(String speciality) {
    model.speciality = speciality;
  }

  void updateAchievements(List<String> achievements) {
    model.achievements = achievements;
  }

  // Add single achievement
  void addAchievement(String achievement) {
    model.achievements.add(achievement);
  }

  // Remove achievement
  void removeAchievement(String achievement) {
    model.achievements.remove(achievement);
  }

  void updateYearsOfExperience(String years) {
    model.yearsOfExperience = years;
  }

  void updateLicenseNumber(String license) {
    model.licenseNumber = license;
  }

  void updateProfileDescription(String description) {
    model.profileDescription = description;
  }

  void updateDigitalSignature(String signature) {
    model.digitalSignature = signature;
  }

  // Validation logic can be added here
  bool validateProfile() {
    return model.speciality != null && model.licenseNumber != null;
  }
}

class ProfileController {
  Profile model = Profile(qualifications: []);

  void updateTitle(String title) {
    model.title = title;
  }

  void updateSurName(String surName) {
    model.surName = surName;
  }

  void updateMiddleName(String middleName) {
    model.middleName = middleName;
  }

  void updateLastName(String lastName) {
    model.lastName = lastName;
  }

  void addQualification(String qualification) {
    model.qualifications.add(qualification);
  }

  void removeQualification(String qualification) {
    model.qualifications.remove(qualification);
  }

  bool validateProfile() {
    return model.qualifications.isNotEmpty;
  }
}

class AddressController {
  Address model = Address(floorBuilding: '');

  void updateFloorBuilding(String floorBuilding) {
    model.floorBuilding = floorBuilding;
  }

  void updateStreet(String street) {
    model.street = street;
  }

  void updateCity(String city) {
    model.city = city;
  }

  void updateState(String state) {
    model.state = state;
  }

  void updateCountry(String country) {
    model.country = country;
  }

  void updatePostalCode(String postalCode) {
    model.postalCode = postalCode;
  }

  // bool validateAddress() {
  //   return model.floorBuilding.isNotEmpty;
  // }
}
