import { MetadataRoute } from 'next';
import { docsNavigation } from '@/docs/navigation';

const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || 'https://quaros.network';
const locales = ['en', 'vi'];

export default function sitemap(): MetadataRoute.Sitemap {
  const routes: MetadataRoute.Sitemap = [];

  // Home pages for each locale
  locales.forEach((locale) => {
    routes.push({
      url: `${baseUrl}/${locale}`,
      lastModified: new Date(),
      changeFrequency: 'weekly',
      priority: 1,
    });
  });

  // Docs pages for each locale
  locales.forEach((locale) => {
    docsNavigation.forEach((group) => {
      group.items.forEach((item) => {
        routes.push({
          url: `${baseUrl}/${locale}/docs/${item.slug}`,
          lastModified: new Date(),
          changeFrequency: 'monthly',
          priority: 0.8,
        });
      });
    });
  });

  return routes;
}

