//! Server-side navigation menu wrapper
//!
//! This is a thin wrapper that prepares SSR-specific data (static menu items)
//! and delegates to the unified implementation.

use crate::navigation::navmenu::unified::UnifiedNavMenu;
use ::rustelo_core_lib::{
    config::get_default_language,
    i18n::{build_page_content_patterns, SsrTranslator},
    load_reactive_menu_for_language,
};
use leptos::prelude::*;

/// Server-side navigation menu wrapper
#[component]
pub fn NavMenuSSR(
    #[prop(default = get_default_language().to_string())] language: String,
) -> impl IntoView {
    // Load menu items for the specified language
    let menu_items = load_reactive_menu_for_language(&language).unwrap_or_default();

    // Prepare i18n content from FTL files
    let ssr_i18n = SsrTranslator::new(language.clone());
    let nav_content = build_page_content_patterns(&ssr_i18n, &["nav-", "lang-"]);

    // Delegate to unified implementation
    view! {
        <UnifiedNavMenu
            language=language
            menu_items=menu_items
            content=nav_content
        />
    }
}

// Re-export as NavMenu for compatibility
pub use NavMenuSSR as NavMenu;
