/**
 * Competitor pricing data — single source of truth for Pricing page cost calculator
 * and comparison pages.
 *
 * IMPORTANT: Update lastVerified when re-checking competitor pricing.
 * CI will warn if any entry is older than 90 days.
 */
export interface CompetitorPrice {
  name: string;
  slug: string;
  monthlyCost: number;
  planName: string;
  /** ISO date string of when this price was last verified */
  lastVerified: string;
  /** URL where the price can be verified */
  sourceUrl: string;
}

export const COMPETITOR_PRICES: CompetitorPrice[] = [
  {
    name: 'Surfer',
    slug: 'surfer-seo',
    monthlyCost: 219,
    planName: 'Scale AI',
    lastVerified: '2026-03-30',
    sourceUrl: 'https://surferseo.com/pricing',
  },
  {
    name: 'Clearscope',
    slug: 'clearscope',
    monthlyCost: 399,
    planName: 'Business',
    lastVerified: '2026-03-30',
    sourceUrl: 'https://www.clearscope.io/pricing',
  },
  {
    name: 'Semrush',
    slug: 'semrush',
    monthlyCost: 139.95,
    planName: 'Pro',
    lastVerified: '2026-03-30',
    sourceUrl: 'https://www.semrush.com/prices/',
  },
];

/**
 * Check if any competitor price is stale (older than maxAgeDays).
 * Used in tests to enforce quarterly review.
 */
export function getStaleEntries(maxAgeDays = 90): CompetitorPrice[] {
  const cutoff = new Date();
  cutoff.setDate(cutoff.getDate() - maxAgeDays);

  return COMPETITOR_PRICES.filter((entry) => new Date(entry.lastVerified) < cutoff);
}
