
import { MetadataRoute } from 'next';

export default function sitemap(): MetadataRoute.Sitemap {
  const baseUrl = process.env.NEXTAUTH_URL || 'https://quote2contract-crm-7yqnrl.abacusai.app';
  
  // Static pages
  const staticPages = [
    '',
    '/landing',
    '/get-quote',
    '/auth/signin',
    '/auth/signup',
    '/south-africa',
    '/usa',
    '/united-kingdom',
    '/australia',
  ].map((route) => ({
    url: `${baseUrl}${route}`,
    lastModified: new Date(),
    changeFrequency: 'monthly' as const,
    priority: route === '' || route === '/landing' ? 1.0 : 0.8,
  }));

  // Dynamic authenticated pages
  const authenticatedPages = [
    '/dashboard',
    '/quotes',
    '/leads',
    '/contracts',
    '/calendar',
    '/cockpit',
    '/analytics',
    '/marketplace',
    '/reviews',
    '/phase3',
  ].map((route) => ({
    url: `${baseUrl}${route}`,
    lastModified: new Date(),
    changeFrequency: 'weekly' as const,
    priority: route === '/dashboard' ? 0.9 : 0.7,
  }));

  return [...staticPages, ...authenticatedPages];
}
