const User = require('./User');

class PersonalUser extends User {
  constructor(id, email, password, firstName, lastName, phone, dateOfBirth, referralEmail, createdAt, updatedAt, role) {
    super(id, email, password, 'personal', createdAt, updatedAt, role);
    this.firstName = firstName;
    this.lastName = lastName;
    this.phone = phone;
    this.dateOfBirth = dateOfBirth;
    this.referralEmail = referralEmail;
  }

  // Get full name
  getFullName() {
    return `${this.firstName} ${this.lastName}`;
  }

  // Override getPublicData to include personal-specific fields
  getPublicData() {
    const baseData = super.getPublicData();
    return {
      ...baseData,
      firstName: this.firstName,
      lastName: this.lastName,
      fullName: this.getFullName(),
      phone: this.phone,
      dateOfBirth: this.dateOfBirth
    };
  }
}

module.exports = PersonalUser;