//! Server-side footer component
//!
//! Static implementation of the footer optimized for SSR rendering.

use leptos::prelude::*;
// Fix Leptos macro conflicts with our 'core' crate
use std::{default::Default, marker::PhantomData};
use ::rustelo_core_lib::config::LogoConfig;

// Import logo component that this depends on
// use crate::logo::LogoLink;

/// Server-side static footer component
#[component]
pub fn FooterSSR(
    /// Language for localization
    #[prop(optional)]
    language: Option<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 {
    let lang = language.unwrap_or_else(|| rustelo_core_lib::config::get_default_language().to_string());

    // Get logo configuration from environment variables (SSR safe)
    let logo_config = LogoConfig::from_env();

    view! {
        <footer class="ds-bg border-t ds-border mt-auto">
            <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
                <div class="flex items-center justify-between">
                    <div class="flex items-center space-x-4">
                        <img src="/logos/jesusperez-logo-b.png" alt="Logo" class="h-6 w-auto" />
                        <span class="text-sm text-gray-500">
                            "© 2024 Jesús Pérez Lorenzo. All rights reserved."
                        </span>
                    </div>
                    {if show_social {
                        view! {
                            <div class="flex space-x-4">
                                <a href="https://github.com/jesusperezlorenzo" target="_blank"
                                   class="text-gray-400 hover:text-gray-500">
                                    "GitHub"
                                </a>
                                <a href="https://linkedin.com/in/jesusperezlorenzo" target="_blank"
                                   class="text-gray-400 hover:text-gray-500">
                                    "LinkedIn"
                                </a>
                            </div>
                        }.into_any()
                    } else {
                        view! { <div></div> }.into_any()
                    }}
                </div>
            </div>
        </footer>
    }
}
