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

class CompanyUser extends User {
  constructor(id, email, password, companyName, companyPhone, contactPersonName, contactPersonPhone, registrationNumber, createdAt, updatedAt, role) {
    super(id, email, password, 'company', createdAt, updatedAt, role);
    this.companyName = companyName;
    this.companyPhone = companyPhone;
    this.contactPersonName = contactPersonName;
    this.contactPersonPhone = contactPersonPhone;
    this.registrationNumber = registrationNumber;
  }

  // Override getPublicData to include company-specific fields
  getPublicData() {
    const baseData = super.getPublicData();
    return {
      ...baseData,
      companyName: this.companyName,
      companyPhone: this.companyPhone,
      contactPersonName: this.contactPersonName,
      contactPersonPhone: this.contactPersonPhone,
      registrationNumber: this.registrationNumber
    };
  }
}

module.exports = CompanyUser;