/**
 * sitemapXml.js
 *
 * GOOGLE RENDERING FIX — key changes vs previous version
 * ─────────────────────────────────────────────────────────────────────────
 * 1. All URLs live under a /lang/ prefix. Non-localised bare paths like
 *    /education, /logbook caused Google to crawl pages with no hreflang
 *    context → "Temporary processing error".
 *
 * 2. Every localised page carries full <xhtml:link rel="alternate"> blocks
 *    so Google can confirm the language cluster from the sitemap alone,
 *    independent of whether JS renders in time.
 *
 * 3. Removed /author/*, /education/CoreNavigation ghost URLs.
 *
 * 4. Private/auth-only pages removed from public sitemap.
 * ─────────────────────────────────────────────────────────────────────────
 */

const BASE = 'https://marstick.com';

function xhtml(paths) {
  return `
    <xhtml:link rel="alternate" hreflang="en"        href="${BASE}${paths.en}"/>
    <xhtml:link rel="alternate" hreflang="he"        href="${BASE}${paths.he}"/>
    <xhtml:link rel="alternate" hreflang="es"        href="${BASE}${paths.es}"/>
    <xhtml:link rel="alternate" hreflang="fr"        href="${BASE}${paths.fr}"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="${BASE}${paths.en}"/>`;
}

const links = {
  home:     xhtml({ en:'/en/', he:'/he/', es:'/es/', fr:'/fr/' }),
  nav:      xhtml({ en:'/en/navigation', he:'/he/%D7%A0%D7%99%D7%95%D7%95%D7%98', es:'/es/navegacion', fr:'/fr/navigation' }),
  weather:  xhtml({ en:'/en/weather', he:'/he/%D7%9E%D7%96%D7%92-%D7%90%D7%95%D7%95%D7%99%D7%A8', es:'/es/tiempo-marino', fr:'/fr/meteo-marine' }),
  safety:   xhtml({ en:'/en/safety', he:'/he/%D7%91%D7%98%D7%99%D7%97%D7%95%D7%AA-%D7%99%D7%9E%D7%99%D7%AA', es:'/es/seguridad-maritima', fr:'/fr/securite-maritime' }),
  marinas:  xhtml({ en:'/en/marinas', he:'/he/%D7%9E%D7%A8%D7%99%D7%A0%D7%95%D7%AA', es:'/es/puertos-marinas', fr:'/fr/ports-marinas' }),
  radar:    xhtml({ en:'/en/radar', he:'/he/radar', es:'/es/radar', fr:'/fr/radar' }),
  learning: xhtml({ en:'/en/learning-center', he:'/he/learning-center', es:'/es/learning-center', fr:'/fr/learning-center' }),
  training: xhtml({ en:'/en/training-center', he:'/he/training-center', es:'/es/training-center', fr:'/fr/training-center' }),
  premium:  xhtml({ en:'/en/premium', he:'/he/premium', es:'/es/premium', fr:'/fr/premium' }),
  advertise:xhtml({ en:'/en/advertise', he:'/he/advertise', es:'/es/advertise', fr:'/fr/advertise' }),
  feedback: xhtml({ en:'/en/feedback', he:'/he/feedback', es:'/es/feedback', fr:'/fr/feedback' }),
  custom:   xhtml({ en:'/en/custom', he:'/he/%D7%9E%D7%99%D7%93%D7%A2', es:'/es/informacion', fr:'/fr/information' }),
};

export const sitemapXml = `<?xml version="1.0" encoding="UTF-8"?>
<urlset
  xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xhtml="http://www.w3.org/1999/xhtml">

  <!-- HOME -->
  <url><loc>${BASE}/en/</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>1.0</priority>${links.home}</url>
  <url><loc>${BASE}/he/</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.9</priority>${links.home}</url>
  <url><loc>${BASE}/es/</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.9</priority>${links.home}</url>
  <url><loc>${BASE}/fr/</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.9</priority>${links.home}</url>

  <!-- NAVIGATION -->
  <url><loc>${BASE}/en/navigation</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.9</priority>${links.nav}</url>
  <url><loc>${BASE}/he/%D7%A0%D7%99%D7%95%D7%95%D7%98</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.nav}</url>
  <url><loc>${BASE}/es/navegacion</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.nav}</url>
  <url><loc>${BASE}/fr/navigation</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.nav}</url>

  <!-- WEATHER -->
  <url><loc>${BASE}/en/weather</loc><lastmod>2026-05-05</lastmod><changefreq>daily</changefreq><priority>0.9</priority>${links.weather}</url>
  <url><loc>${BASE}/he/%D7%9E%D7%96%D7%92-%D7%90%D7%95%D7%95%D7%99%D7%A8</loc><lastmod>2026-05-05</lastmod><changefreq>daily</changefreq><priority>0.8</priority>${links.weather}</url>
  <url><loc>${BASE}/es/tiempo-marino</loc><lastmod>2026-05-05</lastmod><changefreq>daily</changefreq><priority>0.8</priority>${links.weather}</url>
  <url><loc>${BASE}/fr/meteo-marine</loc><lastmod>2026-05-05</lastmod><changefreq>daily</changefreq><priority>0.8</priority>${links.weather}</url>

  <!-- SAFETY -->
  <url><loc>${BASE}/en/safety</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.9</priority>${links.safety}</url>
  <url><loc>${BASE}/he/%D7%91%D7%98%D7%99%D7%97%D7%95%D7%AA-%D7%99%D7%9E%D7%99%D7%AA</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.safety}</url>
  <url><loc>${BASE}/es/seguridad-maritima</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.safety}</url>
  <url><loc>${BASE}/fr/securite-maritime</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.safety}</url>

  <!-- MARINAS -->
  <url><loc>${BASE}/en/marinas</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.9</priority>${links.marinas}</url>
  <url><loc>${BASE}/he/%D7%9E%D7%A8%D7%99%D7%A0%D7%95%D7%AA</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.marinas}</url>
  <url><loc>${BASE}/es/puertos-marinas</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.marinas}</url>
  <url><loc>${BASE}/fr/ports-marinas</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.marinas}</url>

  <!-- RADAR -->
  <url><loc>${BASE}/en/radar</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.radar}</url>
  <url><loc>${BASE}/he/radar</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority>${links.radar}</url>
  <url><loc>${BASE}/es/radar</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority>${links.radar}</url>
  <url><loc>${BASE}/fr/radar</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority>${links.radar}</url>

  <!-- LEARNING CENTER -->
  <url><loc>${BASE}/en/learning-center</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.learning}</url>
  <url><loc>${BASE}/he/learning-center</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority>${links.learning}</url>
  <url><loc>${BASE}/es/learning-center</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority>${links.learning}</url>
  <url><loc>${BASE}/fr/learning-center</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority>${links.learning}</url>

  <!-- TRAINING CENTER -->
  <url><loc>${BASE}/en/training-center</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.8</priority>${links.training}</url>
  <url><loc>${BASE}/he/training-center</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority>${links.training}</url>
  <url><loc>${BASE}/es/training-center</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority>${links.training}</url>
  <url><loc>${BASE}/fr/training-center</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority>${links.training}</url>

  <!-- PREMIUM -->
  <url><loc>${BASE}/en/premium</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.7</priority>${links.premium}</url>
  <url><loc>${BASE}/he/premium</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.6</priority>${links.premium}</url>
  <url><loc>${BASE}/es/premium</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.6</priority>${links.premium}</url>
  <url><loc>${BASE}/fr/premium</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.6</priority>${links.premium}</url>

  <!-- ADVERTISE -->
  <url><loc>${BASE}/en/advertise</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.7</priority>${links.advertise}</url>
  <url><loc>${BASE}/he/advertise</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.6</priority>${links.advertise}</url>
  <url><loc>${BASE}/es/advertise</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.6</priority>${links.advertise}</url>
  <url><loc>${BASE}/fr/advertise</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.6</priority>${links.advertise}</url>

  <!-- FEEDBACK -->
  <url><loc>${BASE}/en/feedback</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.6</priority>${links.feedback}</url>
  <url><loc>${BASE}/he/feedback</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.5</priority>${links.feedback}</url>
  <url><loc>${BASE}/es/feedback</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.5</priority>${links.feedback}</url>
  <url><loc>${BASE}/fr/feedback</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.5</priority>${links.feedback}</url>

  <!-- ABOUT / CUSTOM -->
  <url><loc>${BASE}/en/custom</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.6</priority>${links.custom}</url>
  <url><loc>${BASE}/he/%D7%9E%D7%99%D7%93%D7%A2</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.5</priority>${links.custom}</url>
  <url><loc>${BASE}/es/informacion</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.5</priority>${links.custom}</url>
  <url><loc>${BASE}/fr/information</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.5</priority>${links.custom}</url>

  <!-- STATIC / EN-only public pages -->
  <url><loc>${BASE}/en/skipper-tools</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
  <url><loc>${BASE}/en/route-library</loc><lastmod>2026-05-05</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
  <url><loc>${BASE}/en/port-entry</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.6</priority></url>
  <url><loc>${BASE}/en/affiliate</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.6</priority></url>
  <url><loc>${BASE}/privacy</loc><lastmod>2026-05-05</lastmod><changefreq>yearly</changefreq><priority>0.3</priority></url>
  <url><loc>${BASE}/terms</loc><lastmod>2026-05-05</lastmod><changefreq>yearly</changefreq><priority>0.3</priority></url>
  <url><loc>${BASE}/contact</loc><lastmod>2026-05-05</lastmod><changefreq>monthly</changefreq><priority>0.5</priority></url>

</urlset>`;
