import { MetadataRoute } from 'next';

const baseUrl = 'https://kitebeachakyaka.com.tr';
const langs = ['tr', 'en'];
const routes = [
  { path: '',              changeFrequency: 'daily'   as const, priority: 1.0 },
  { path: '/odalar',      changeFrequency: 'weekly'  as const, priority: 0.9 },
  { path: '/aktiviteler', changeFrequency: 'weekly'  as const, priority: 0.9 },
  { path: '/etkinlikler', changeFrequency: 'weekly'  as const, priority: 0.9 },
  { path: '/restoran',    changeFrequency: 'weekly'  as const, priority: 0.8 },
  { path: '/iletisim',    changeFrequency: 'monthly' as const, priority: 0.8 },
  { path: '/hakkimizda',  changeFrequency: 'monthly' as const, priority: 0.7 },
  { path: '/galeri',      changeFrequency: 'monthly' as const, priority: 0.7 },
  { path: '/gizlilik',    changeFrequency: 'monthly' as const, priority: 0.3 },
  { path: '/kvkk',        changeFrequency: 'monthly' as const, priority: 0.3 },
  { path: '/cerez',       changeFrequency: 'monthly' as const, priority: 0.3 },
];

export default function sitemap(): MetadataRoute.Sitemap {
  return langs.flatMap((lang) =>
    routes.map(({ path, changeFrequency, priority }) => ({
      url: `${baseUrl}/${lang}${path}`,
      lastModified: new Date(),
      changeFrequency,
      priority,
      alternates: {
        languages: {
          'x-default': `${baseUrl}/tr${path}`,
          ...Object.fromEntries(langs.map((l) => [l, `${baseUrl}/${l}${path}`])),
        },
      },
    }))
  );
}
