import type { MetadataRoute } from 'next'

const BASE_URL = 'https://letsbe.biz'

const STATIC_ROUTES = ['', '/about', '/services']
const PROJECT_SLUGS = ['monaco-ocean', 'port-nimara', 'port-amador']

export default function sitemap(): MetadataRoute.Sitemap {
  const now = new Date()

  const staticEntries: MetadataRoute.Sitemap = STATIC_ROUTES.map((route) => ({
    url: `${BASE_URL}${route}`,
    lastModified: now,
    changeFrequency: route === '' ? 'weekly' : 'monthly',
    priority: route === '' ? 1.0 : 0.8,
    alternates: {
      languages: {
        en: `${BASE_URL}${route}`,
        fr: `${BASE_URL}/fr${route}`,
        it: `${BASE_URL}/it${route}`,
        es: `${BASE_URL}/es${route}`,
        'x-default': `${BASE_URL}${route}`,
      },
    },
  }))

  const projectEntries: MetadataRoute.Sitemap = PROJECT_SLUGS.map((slug) => ({
    url: `${BASE_URL}/work/${slug}`,
    lastModified: now,
    changeFrequency: 'monthly' as const,
    priority: 0.7,
    alternates: {
      languages: {
        en: `${BASE_URL}/work/${slug}`,
        fr: `${BASE_URL}/fr/work/${slug}`,
        it: `${BASE_URL}/it/work/${slug}`,
        es: `${BASE_URL}/es/work/${slug}`,
        'x-default': `${BASE_URL}/work/${slug}`,
      },
    },
  }))

  return [...staticEntries, ...projectEntries]
}
