/**
 * Sponsor Settings View Model
 *
 * View model for sponsor settings data.
 */
export class SponsorSettingsViewModel {
  profile: SponsorProfileViewModel;
  notifications: NotificationSettingsViewModel;
  privacy: PrivacySettingsViewModel;

  constructor(data: { profile: any; notifications: any; privacy: any }) {
    this.profile = new SponsorProfileViewModel(data.profile);
    this.notifications = new NotificationSettingsViewModel(data.notifications);
    this.privacy = new PrivacySettingsViewModel(data.privacy);
  }
}

export class SponsorProfileViewModel {
  companyName: string;
  contactName: string;
  contactEmail: string;
  contactPhone: string;
  website: string;
  description: string;
  logoUrl: string | null;
  industry: string;
  address: {
    street: string;
    city: string;
    country: string;
    postalCode: string;
  };
  taxId: string;
  socialLinks: {
    twitter: string;
    linkedin: string;
    instagram: string;
  };

  constructor(data: any) {
    this.companyName = data.companyName;
    this.contactName = data.contactName;
    this.contactEmail = data.contactEmail;
    this.contactPhone = data.contactPhone;
    this.website = data.website;
    this.description = data.description;
    this.logoUrl = data.logoUrl;
    this.industry = data.industry;
    this.address = data.address;
    this.taxId = data.taxId;
    this.socialLinks = data.socialLinks;
  }

  get fullAddress(): string {
    return `${this.address.street}, ${this.address.city}, ${this.address.postalCode}, ${this.address.country}`;
  }
}

export class NotificationSettingsViewModel {
  emailNewSponsorships: boolean;
  emailWeeklyReport: boolean;
  emailRaceAlerts: boolean;
  emailPaymentAlerts: boolean;
  emailNewOpportunities: boolean;
  emailContractExpiry: boolean;

  constructor(data: any) {
    this.emailNewSponsorships = data.emailNewSponsorships;
    this.emailWeeklyReport = data.emailWeeklyReport;
    this.emailRaceAlerts = data.emailRaceAlerts;
    this.emailPaymentAlerts = data.emailPaymentAlerts;
    this.emailNewOpportunities = data.emailNewOpportunities;
    this.emailContractExpiry = data.emailContractExpiry;
  }
}

export class PrivacySettingsViewModel {
  publicProfile: boolean;
  showStats: boolean;
  showActiveSponsorships: boolean;
  allowDirectContact: boolean;

  constructor(data: any) {
    this.publicProfile = data.publicProfile;
    this.showStats = data.showStats;
    this.showActiveSponsorships = data.showActiveSponsorships;
    this.allowDirectContact = data.allowDirectContact;
  }
}