//! Client-side footer wrapper
//!
//! This is a thin wrapper that prepares client-specific data (reactive
//! language) and delegates to the unified implementation.

use ::rustelo_core_lib::{
    config::get_default_language,
    i18n::{build_page_content_patterns, UnifiedI18n},
    state::use_language,
};
use leptos::prelude::*;

use crate::navigation::footer::unified::UnifiedFooter;

/// Client-side footer wrapper
#[component]
pub fn FooterClient(
    set_path: WriteSignal<String>,
    path: ReadSignal<String>,
    #[prop(default = get_default_language().to_string())] _language: String,
    /// Custom CSS class
    #[prop(optional)]
    class: Option<String>,
    /// Show social links
    #[prop(default = true)]
    show_social: bool,
    /// Show scroll to top button
    #[prop(default = true)]
    show_scroll_to_top: bool,
) -> impl IntoView {
    // All functionality is handled by the unified footer component
    // Get language context to track reactive language changes
    let language_context = use_language();
    let lang_content = Memo::new(move |_| {
        let current_language = language_context.current.get();
        let i18n = UnifiedI18n::new(&current_language, "/");
        build_page_content_patterns(&i18n, &["footer-", "lang-"])
    });
    move || {
        view! {
            <UnifiedFooter
                navigation_signals=(path.clone(), set_path.clone())
                language=language_context.current.get()
                lang_content=lang_content.get()
                class=class.clone().unwrap_or_default()
                show_social=show_social
                show_scroll_to_top=show_scroll_to_top
            />
        }
    }
}

// Re-export as Footer for compatibility
// pub use FooterClient as Footer;
