# Route table — single source of truth for all URL paths and navigation menus
#
# Adding a new route: add a make_route/make_content_route record here.
# Adding a new language: add the lang code to site.ncl and add a `paths` entry
# to every route record — no other files need changing.

let site_d = import "site/defaults.ncl" in
let site_c = import "site/contracts.ncl" in
let { make_route, make_content_route, make_external, priorities, orders, no_menu }
  = site_d in

{
  routes = [
    # ── Home ────────────────────────────────────────────────────────────────
    make_route "HomePage" { en = "/", es = "/inicio" }
      & {
        priority = priorities.critical,
        menu = {
          enabled   = true,
          order     = orders.home,
          icon      = "home",
          label_key = "nav-home",
          labels    = { en = "Home", es = "Inicio" },
          use_in    = ["header"],
        },
      },

    # Alternate Spanish home path (/es) — no menu entry
    make_route "HomePage" { es = "/es" }
      & {
        priority = priorities.critical,
        menu     = no_menu,
      },

    # Alternate English home path (/en) — no menu entry
    make_route "HomePage" { en = "/en" }
      & {
        priority = priorities.critical,
        menu     = no_menu,
      },

    # ── About ────────────────────────────────────────────────────────────────
    make_route "AboutPage" { en = "/about", es = "/acerca-de" }
      & {
        priority = priorities.high,
        menu = {
          enabled   = true,
          order     = orders.about,
          icon      = "fas fa-user",
          label_key = "nav-about",
          labels    = { en = "About", es = "Acerca de" },
          use_in    = ["header"],
        },
      },

    # ── Services ─────────────────────────────────────────────────────────────
    make_route "ServicesPage" { en = "/services", es = "/servicios" }
      & {
        priority = priorities.high,
        menu = {
          enabled   = true,
          order     = orders.services,
          icon      = "briefcase",
          label_key = "nav-services",
          labels    = { en = "Services", es = "Servicios" },
          use_in    = ["header"],
        },
      },

    # ── Projects article viewer ───────────────────────────────────────────────
    make_content_route "PostViewer" "projects" { en = "/projects/{slug}", es = "/proyectos/{slug}" }
      & {
        priority = priorities.low,
        menu     = no_menu,
      },

    # ── Projects (content index) ──────────────────────────────────────────────
    make_content_route "ContentIndex" "projects" { en = "/projects", es = "/proyectos" }
      & {
        priority = priorities.high,
        menu = {
          enabled   = true,
          order     = orders.projects,
          icon      = "folder",
          label_key = "nav-projects",
          labels    = { en = "Projects", es = "Proyectos" },
          use_in    = ["header"],
        },
        props = {
          content_type   = "projects",
          cta_view       = "ProjectsCTAView",
          style_css      = "projects-content",
          style_mode     = "grid",
          use_categories = true,
          use_feature    = true,
          use_tags       = true,
        },
      },

    # ── Activities article viewer ─────────────────────────────────────────────
    make_content_route "PostViewer" "activities" { en = "/activities/{category}/{slug}", es = "/actividades/{category}/{slug}" }
      & {
        priority = priorities.minimal,
        menu     = no_menu,
      },

    # ── Activities category filter ────────────────────────────────────────────
    make_content_route "ContentIndex" "activities" { en = "/activities/{category}", es = "/actividades/{category}" }
      & {
        priority = priorities.low,
        menu     = no_menu,
      },

    # ── Activities (content index) ────────────────────────────────────────────
    make_content_route "ContentIndex" "activities" { en = "/activities", es = "/actividades" }
      & {
        priority = priorities.normal,
        menu = {
          enabled   = true,
          order     = 7,
          icon      = "presentation",
          label_key = "nav-activities",
          labels    = { en = "Activities", es = "Actividades" },
          use_in    = ["header"],
        },
        props = {
          content_type   = "activities",
          cta_view       = "ActivitiesCTAView",
          style_css      = "activities-content",
          style_mode     = "grid",
          use_categories = true,
          use_feature    = true,
          use_tags       = true,
        },
      },

    # ── Blog article viewer ───────────────────────────────────────────────────
    make_content_route "PostViewer" "blog" { en = "/blog/{category}/{slug}", es = "/blog/{category}/{slug}" }
      & {
        priority = priorities.minimal,
        menu     = no_menu,
      },

    # ── Recipes article viewer ────────────────────────────────────────────────
    make_content_route "PostViewer" "recipes" { en = "/recipes/{category}/{slug}", es = "/recetas/{category}/{slug}" }
      & {
        priority = priorities.minimal,
        menu     = no_menu,
      },

    # ── Blog category filter ──────────────────────────────────────────────────
    make_content_route "ContentIndex" "blog" { en = "/blog/{category}", es = "/blog/{category}" }
      & {
        priority = priorities.low,
        menu     = no_menu,
      },

    # ── Recipes category filter ───────────────────────────────────────────────
    make_content_route "ContentIndex" "recipes" { en = "/recipes/{category}", es = "/recetas/{category}" }
      & {
        priority = priorities.low,
        menu     = no_menu,
      },

    # ── Blog (content index) ──────────────────────────────────────────────────
    make_content_route "ContentIndex" "blog" { en = "/blog", es = "/blog" }
      & {
        priority = priorities.normal,
        menu = {
          enabled   = true,
          order     = orders.blog,
          icon      = "book",
          label_key = "nav-blog",
          labels    = { en = "Blog", es = "Blog" },
          use_in    = ["header"],
        },
        props = {
          content_type   = "blog",
          cta_view       = "BlogCTAView",
          style_css      = "blog-content",
          style_mode     = "row",
          use_categories = true,
          use_emojis     = true,
          use_feature    = true,
          use_links = [
            ["archive",    "/blog/archive"],
            ["rss",        "/blog/rss.xml"],
            ["categories", "/blog/categories"],
          ],
          use_tags = true,
        },
      },

    # ── Recipes (content index) ───────────────────────────────────────────────
    make_content_route "ContentIndex" "recipes" { en = "/recipes", es = "/recetas" }
      & {
        priority = priorities.normal,
        menu = {
          enabled   = true,
          order     = orders.recipes,
          icon      = "lightbulb",
          label_key = "nav-recipes",
          labels    = { en = "Recipes", es = "Recetas" },
          use_in    = ["header"],
        },
        props = {
          content_type   = "recipes",
          cta_view       = "RecipesCTAView",
          style_css      = "recipes-content",
          style_mode     = "row",
          use_categories = true,
          use_feature    = true,
        },
      },

    # ── Content Graph ─────────────────────────────────────────────────────────
    make_route "ContentGraphPage" { en = "/graph", es = "/grafo" }
      & {
        priority = priorities.low,
        menu     = no_menu,
      },

    # ── Ontoref ───────────────────────────────────────────────────────────────
    make_route "OntorefPage" { en = "/ontoref", es = "/ontoref" }
      & {
        priority = priorities.normal,
        menu     = no_menu,
      },

    # ── Rustelo ───────────────────────────────────────────────────────────────
    make_route "RusteloPage" { en = "/rustelo", es = "/rustelo" }
      & {
        priority = priorities.normal,
        menu     = no_menu,
      },

    # ── Vapora ────────────────────────────────────────────────────────────────
    make_route "VaporaPage" { en = "/vapora", es = "/vapora" }
      & {
        priority = priorities.normal,
        menu     = no_menu,
      },

    # ── Provisioning ─────────────────────────────────────────────────────────
    make_route "ProvisioningPage" { en = "/provisioning-systems", es = "/provisioning-systems" }
      & {
        priority = priorities.normal,
        menu     = no_menu,
      },

    # ── StratumIOps ─────────────────────────────────────────────────────────
    make_route "StratumiopsPage" { en = "/stratumiops", es = "/stratumiops" }
      & {
        priority = priorities.normal,
        menu     = no_menu,
      },

    # ── SecretumVault ───────────────────────────────────────────────────────
    make_route "SecretumvaultPage" { en = "/secretumvault", es = "/secretumvault" }
      & {
        priority = priorities.normal,
        menu     = no_menu,
      },

    # ── Kogral ───────────────────────────────────────────────────────────────
    make_route "KogralPage" { en = "/kogral", es = "/kogral" }
      & {
        priority = priorities.normal,
        menu     = no_menu,
      },

    # ── TypeDialog ───────────────────────────────────────────────────────────
    make_route "TypedialogPage" { en = "/typedialog", es = "/typedialog" }
      & {
        priority = priorities.normal,
        menu     = no_menu,
      },

    # ── Syntaxis ─────────────────────────────────────────────────────────────
    make_route "SyntaxisPage" { en = "/syntaxis", es = "/syntaxis" }
      & {
        priority = priorities.normal,
        menu     = no_menu,
      },

    # ── Work Request ──────────────────────────────────────────────────────────
    make_route "WorkRequestPage" { en = "/work-request", es = "/solicitud-trabajo" }
      & {
        priority = priorities.normal,
        menu     = no_menu,
      },

    # ── Contact ───────────────────────────────────────────────────────────────
    make_route "ContactPage" { en = "/contact", es = "/contacto" }
      & {
        priority = priorities.normal,
        menu = {
          enabled   = true,
          order     = orders.contact,
          icon      = "fas fa-envelope",
          label_key = "nav-contact",
          labels    = { en = "Contact", es = "Contacto" },
          use_in    = ["header"],
        },
      },

    # ── Legal / footer routes ─────────────────────────────────────────────────
    make_route "LegalPage" { en = "/legal", es = "/legal" }
      & {
        priority = priorities.low,
        menu = {
          enabled   = true,
          order     = 2,
          icon      = "fas fa-gavel",
          label_key = "nav-legal",
          labels    = { en = "Legal Notice", es = "Aviso Legal" },
          use_in    = ["footer"],
        },
      },

    make_route "PrivacyPage" { en = "/privacy", es = "/privacidad" }
      & {
        priority = priorities.low,
        menu = {
          enabled   = true,
          order     = 1,
          icon      = "fas fa-shield-alt",
          label_key = "nav-privacy",
          labels    = { en = "Privacy Policy", es = "Política de Privacidad" },
          use_in    = ["footer"],
        },
      },

    # ── User (not in sitemap) ─────────────────────────────────────────────────
    make_route "UserPage" { en = "/user", es = "/usuario" }
      & {
        priority = priorities.minimal,
        menu     = no_menu,
      },

    # ── Sign-out goodbye page ─────────────────────────────────────────────────
    make_route "SignoutPage" { en = "/signout", es = "/hasta-pronto" }
      & {
        priority = priorities.minimal,
        menu     = no_menu,
      },

    # ── Login (passwordless OTP) ──────────────────────────────────────────────
    make_route "LoginPage" { en = "/login", es = "/iniciar-sesion" }
      & {
        priority = priorities.minimal,
        menu     = no_menu,
      },

    # ── External links ────────────────────────────────────────────────────────
    make_external "Kit-Digital" "/kitdigital.html"
      & {
        menu = {
          enabled    = true,
          order      = orders.external,
          label_key  = "nav-kit-digital",
          labels     = { en = "Kit-Digital", es = "Kit-Digital" },
          visible_in = ["es"],
          use_in     = ["header"],
        },
      },
  ],
}
