//! Generated Unified {ComponentName} Page Component
//!
//! Auto-generated basic page implementation for simple informational content.

use leptos::prelude::*;
use shared::i18n::create_content_provider;

/// Unified {ComponentName} page component that delegates to appropriate implementation
#[component]
pub fn {ComponentName}Page(_language: String) -> impl IntoView {
    #[cfg(not(target_arch = "wasm32"))]
    {
        // SSR context: use static implementation
        view! {
            <crate::{ModuleName}::ssr::{ComponentName}PageSSR language=_language.clone() />
        }
    }

    #[cfg(target_arch = "wasm32")]
    {
        // Client context: use reactive implementation
        view! {
            <crate::{ModuleName}::client::{ComponentName}PageClient language=_language.clone() />
        }
    }
}

/// Unified {ComponentName} Page component that works in both SSR and client contexts
/// Takes structured content data instead of individual parameters
#[component]
pub fn Unified{ComponentName}Page(
    #[prop(optional)] lang_content: Option<std::collections::HashMap<String, String>>,
) -> impl IntoView {
    // Use DRY content accessor helper
    let content = create_content_provider(lang_content.clone());

    view! {
        <div class="ds-bg-page py-ds-6">
            <section class="ds-container max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
                // Header Section
                <div class="text-center mb-ds-8">
                    <h1 class="ds-heading-1 ds-text mb-ds-4">
                        {content.t("{prefix}-page-title")}
                    </h1>
                    <div class="mt-ds-6 ds-body ds-text-secondary max-w-2xl mx-auto">
                        <components::HtmlContent
                            content={content.t("{prefix}-page-content")}
                            class="prose prose-lg max-w-none ds-text-secondary".to_string()
                        />
                    </div>
                </div>

                // Optional description section
                {move || {
                    let description = content.t_quiet("{prefix}-page-description");
                    if !description.is_empty() {
                        view! {
                            <div class="ds-bg ds-rounded-lg ds-shadow-sm p-ds-6 mt-ds-8">
                                <components::HtmlContent
                                    content=description
                                    class="ds-body ds-text-secondary".to_string()
                                />
                            </div>
                        }.into_view()
                    } else {
                        view! {}.into_view()
                    }
                }}
            </section>
        </div>
    }
}
