use dioxus::prelude::*;
use dioxus_free_icons::icons::bs_icons::BsShieldCheck;
use dioxus_free_icons::Icon;

use crate::i18n::{t, Locale};
use crate::Route;

/// Impressum (legal notice) page required by German/EU law.
///
/// Displays placeholder company information. This page is publicly
/// accessible without authentication.
#[component]
pub fn ImpressumPage() -> Element {
    let locale = use_context::<Signal<Locale>>();
    let l = *locale.read();

    rsx! {
        div { class: "legal-page",
            nav { class: "legal-nav",
                Link { to: Route::LandingPage {}, class: "landing-logo",
                    span { class: "landing-logo-icon",
                        Icon { icon: BsShieldCheck, width: 20, height: 20 }
                    }
                    span { "CERTifAI" }
                }
            }
            main { class: "legal-content",
                h1 { "{t(l, \"impressum.title\")}" }

                h2 { "{t(l, \"impressum.info_tmg\")}" }
                p {
                    "{t(l, \"impressum.company\")}"
                    br {}
                    "{t(l, \"impressum.address_street\")}"
                    br {}
                    "{t(l, \"impressum.address_city\")}"
                    br {}
                    "{t(l, \"impressum.address_country\")}"
                }

                h2 { "{t(l, \"impressum.represented_by\")}" }
                p { "{t(l, \"impressum.managing_director\")}" }

                h2 { "{t(l, \"impressum.contact\")}" }
                p {
                    "{t(l, \"impressum.email\")}"
                    br {}
                    "{t(l, \"impressum.phone\")}"
                }

                h2 { "{t(l, \"impressum.commercial_register\")}" }
                p {
                    "{t(l, \"impressum.registered_at\")}"
                    br {}
                    "{t(l, \"impressum.registration_number\")}"
                }

                h2 { "{t(l, \"impressum.vat_id\")}" }
                p { "{t(l, \"impressum.vat_number\")}" }

                h2 { "{t(l, \"impressum.responsible_content\")}" }
                p {
                    "[Name]"
                    br {}
                    "{t(l, \"impressum.company\")}"
                    br {}
                    "{t(l, \"impressum.address_street\")}"
                    br {}
                    "{t(l, \"impressum.address_city\")}"
                }
            }
            footer { class: "legal-footer",
                Link { to: Route::LandingPage {}, "{t(l, \"common.back_to_home\")}" }
                Link { to: Route::PrivacyPage {}, "{t(l, \"common.privacy_policy\")}" }
            }
        }
    }
}
