import 'dart:io';

class ChildminderId {
  String firstName;
  String lastName;
  String address;
  String postalCode;
  String city;
  String phone;
  String email;
  String password;
  File? profilePicture;
  bool photoConsent;

  ChildminderId({
    this.firstName = '',
    this.lastName = '',
    this.address = '',
    this.postalCode = '',
    this.city = '',
    this.phone = '',
    this.email = '',
    this.password = '',
    this.profilePicture,
    this.photoConsent = false,
  });
}

class ChildminderProfessional {
  String dateOfBirth;
  String birthCity;
  String birthCountry;
  String socialSecurityNumber; // NIR
  String agreementNumber;
  int maxChildren;

  ChildminderProfessional({
    this.dateOfBirth = '',
    this.birthCity = '',
    this.birthCountry = '',
    this.socialSecurityNumber = '',
    this.agreementNumber = '',
    this.maxChildren = 1,
  });
}

class ChildminderRegistrationData {
  ChildminderId identity;
  ChildminderProfessional professional;
  String presentationMessage;
  bool cguAccepted;
  bool isPhotoRequired;

  ChildminderRegistrationData({
    ChildminderId? identityData,
    ChildminderProfessional? professionalData,
    this.presentationMessage = '',
    this.cguAccepted = false,
    this.isPhotoRequired = false,
  })  : identity = identityData ?? ChildminderId(),
        professional = professionalData ?? ChildminderProfessional();

  void updateIdentity(ChildminderId data) {
    identity = data;
  }

  void updateProfessional(ChildminderProfessional data) {
    professional = data;
  }

  void updatePresentation(String message) {
    presentationMessage = message;
  }

  void acceptCGU() {
    cguAccepted = true;
  }

  bool get isComplete {
    return identity.firstName.isNotEmpty &&
           identity.lastName.isNotEmpty &&
           identity.address.isNotEmpty &&
           identity.postalCode.isNotEmpty &&
           identity.city.isNotEmpty &&
           identity.phone.isNotEmpty &&
           identity.email.isNotEmpty &&
           identity.password.isNotEmpty &&
           professional.dateOfBirth.isNotEmpty &&
           professional.birthCity.isNotEmpty &&
           professional.birthCountry.isNotEmpty &&
           professional.socialSecurityNumber.isNotEmpty &&
           professional.agreementNumber.isNotEmpty &&
           cguAccepted &&
           (!isPhotoRequired || (identity.profilePicture != null && identity.photoConsent));
  }
}