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

  constructor(data: { profile: unknown; notifications: unknown; privacy: unknown }) {
    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: unknown) {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    const d = data as any;
    this.companyName = d.companyName;
    this.contactName = d.contactName;
    this.contactEmail = d.contactEmail;
    this.contactPhone = d.contactPhone;
    this.website = d.website;
    this.description = d.description;
    this.logoUrl = d.logoUrl;
    this.industry = d.industry;
    this.address = d.address;
    this.taxId = d.taxId;
    this.socialLinks = d.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: unknown) {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    const d = data as any;
    this.emailNewSponsorships = d.emailNewSponsorships;
    this.emailWeeklyReport = d.emailWeeklyReport;
    this.emailRaceAlerts = d.emailRaceAlerts;
    this.emailPaymentAlerts = d.emailPaymentAlerts;
    this.emailNewOpportunities = d.emailNewOpportunities;
    this.emailContractExpiry = d.emailContractExpiry;
  }
}

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

  constructor(data: unknown) {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    const d = data as any;
    this.publicProfile = d.publicProfile;
    this.showStats = d.showStats;
    this.showActiveSponsorships = d.showActiveSponsorships;
    this.allowDirectContact = d.allowDirectContact;
  }
}