//! Live preview pane showing what will be generated

use ratatui::{
    layout::{Alignment, Constraint, Direction, Layout, Rect},
    style::{Color, Modifier, Style},
    text::{Line, Span},
    widgets::{Block, Borders, List, ListItem, Paragraph, Tabs, Wrap},
    Frame,
};

// TODO: Add syntect-based syntax highlighting in future iterations
// #[cfg(feature = "preview")]
// use syntect::easy::HighlightLines;
use crate::manager::app::App;

/// Available preview tabs
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PreviewTab {
    FileList,
    RouteConfig,
    Component,
    Translations,
}

impl PreviewTab {
    pub fn all() -> Vec<Self> {
        vec![
            Self::FileList,
            Self::RouteConfig,
            Self::Component,
            Self::Translations,
        ]
    }

    pub fn title(&self) -> &'static str {
        match self {
            Self::FileList => "Files",
            Self::RouteConfig => "Route Config",
            Self::Component => "Component",
            Self::Translations => "Translations",
        }
    }
}

/// Preview state extension for App
pub struct PreviewState {
    pub selected_tab: PreviewTab,
    pub selected_translation_lang: usize,
}

impl Default for PreviewState {
    fn default() -> Self {
        Self {
            selected_tab: PreviewTab::FileList,
            selected_translation_lang: 0,
        }
    }
}

impl PreviewState {
    pub fn new() -> Self {
        Self::default()
    }

    pub fn next_tab(&mut self) {
        let tabs = PreviewTab::all();
        let current_index = tabs
            .iter()
            .position(|&t| t == self.selected_tab)
            .unwrap_or(0);
        self.selected_tab = tabs[(current_index + 1) % tabs.len()];
    }

    pub fn previous_tab(&mut self) {
        let tabs = PreviewTab::all();
        let current_index = tabs
            .iter()
            .position(|&t| t == self.selected_tab)
            .unwrap_or(0);
        self.selected_tab = tabs[if current_index == 0 {
            tabs.len() - 1
        } else {
            current_index - 1
        }];
    }
}

/// Render the preview pane
pub fn render_preview_pane(frame: &mut Frame, area: Rect, app: &App, preview_state: &PreviewState) {
    let is_focused = app.focus == crate::manager::app::Focus::Preview;
    let preview_block = Block::default()
        .borders(Borders::ALL)
        .title("Live Preview")
        .border_style(if is_focused {
            Style::default().fg(Color::Cyan)
        } else {
            Style::default().fg(Color::Blue)
        });

    let preview_area = preview_block.inner(area);
    frame.render_widget(preview_block, area);

    if !app.is_valid() {
        render_invalid_preview(frame, preview_area, app);
        return;
    }

    // Split preview area into tabs and content
    let preview_chunks = Layout::default()
        .direction(Direction::Vertical)
        .constraints([
            Constraint::Length(3), // Tab bar
            Constraint::Min(0),    // Tab content
        ])
        .split(preview_area);

    // Render tab bar
    render_preview_tabs(frame, preview_chunks[0], preview_state);

    // Render selected tab content
    match preview_state.selected_tab {
        PreviewTab::FileList => render_file_list_tab(frame, preview_chunks[1], app),
        PreviewTab::RouteConfig => render_route_config_tab(frame, preview_chunks[1], app),
        PreviewTab::Component => render_component_tab(frame, preview_chunks[1], app),
        PreviewTab::Translations => {
            render_translations_tab(frame, preview_chunks[1], app, preview_state)
        }
    }
}

/// Render invalid preview message
fn render_invalid_preview(frame: &mut Frame, area: Rect, app: &App) {
    let error_count = app.validation_errors.len();
    let content = vec![
        Line::from(""),
        Line::from(vec![
            Span::styled("⚠️ ", Style::default().fg(Color::Yellow)),
            Span::styled(
                "Configuration Invalid",
                Style::default().fg(Color::Red).add_modifier(Modifier::BOLD),
            ),
        ]),
        Line::from(""),
        Line::from(format!(
            "Fix {} validation error{} to see preview:",
            error_count,
            if error_count == 1 { "" } else { "s" }
        )),
        Line::from(""),
    ];

    let mut error_lines = content;
    for error in &app.validation_errors {
        error_lines.push(Line::from(vec![
            Span::styled("❌ ", Style::default().fg(Color::Red)),
            Span::styled(&error.message, Style::default().fg(Color::Red)),
        ]));
    }

    let paragraph = Paragraph::new(error_lines)
        .alignment(Alignment::Center)
        .wrap(Wrap { trim: true });

    frame.render_widget(paragraph, area);
}

/// Render preview tabs
fn render_preview_tabs(frame: &mut Frame, area: Rect, preview_state: &PreviewState) {
    let tab_titles: Vec<Line> = PreviewTab::all()
        .iter()
        .map(|tab| Line::from(tab.title()))
        .collect();

    let selected_index = PreviewTab::all()
        .iter()
        .position(|&t| t == preview_state.selected_tab)
        .unwrap_or(0);

    let tabs = Tabs::new(tab_titles)
        .block(Block::default().borders(Borders::ALL))
        .highlight_style(
            Style::default()
                .fg(Color::Yellow)
                .add_modifier(Modifier::BOLD),
        )
        .select(selected_index);

    frame.render_widget(tabs, area);
}

/// Render file list tab
fn render_file_list_tab(frame: &mut Frame, area: Rect, app: &App) {
    let files_to_create = generate_file_list(app);

    let items: Vec<ListItem> = files_to_create
        .iter()
        .map(|(file_type, path, status)| {
            let (icon, color) = match status {
                FileStatus::Create => ("✓", Color::Green),
                FileStatus::Update => ("⚡", Color::Yellow),
                FileStatus::Exists => ("ℹ️", Color::Blue),
            };

            let line = Line::from(vec![
                Span::styled(format!("{} ", icon), Style::default().fg(color)),
                Span::styled(file_type.clone(), Style::default().fg(Color::Cyan)),
                Span::raw(" "),
                Span::styled(path.clone(), Style::default()),
            ]);

            ListItem::new(line)
        })
        .collect();

    let file_list = List::new(items).block(
        Block::default()
            .title("Files to create/update")
            .borders(Borders::ALL),
    );

    frame.render_widget(file_list, area);
}

/// Render route config tab
fn render_route_config_tab(frame: &mut Frame, area: Rect, app: &App) {
    let route_config = generate_route_config(app);

    let content = vec![
        Line::from(vec![Span::styled(
            "Route Configuration:",
            Style::default().add_modifier(Modifier::BOLD),
        )]),
        Line::from(""),
    ];

    let mut config_lines = content;
    for line in route_config.lines() {
        // Simple syntax highlighting for TOML
        if line.trim().starts_with('#') {
            config_lines.push(Line::from(Span::styled(
                line,
                Style::default().fg(Color::Green),
            )));
        } else if line.contains('=') {
            let parts: Vec<&str> = line.splitn(2, '=').collect();
            if parts.len() == 2 {
                config_lines.push(Line::from(vec![
                    Span::styled(
                        parts[0],
                        Style::default()
                            .fg(Color::Blue)
                            .add_modifier(Modifier::BOLD),
                    ),
                    Span::styled("=", Style::default()),
                    Span::styled(parts[1], Style::default().fg(Color::Yellow)),
                ]));
            } else {
                config_lines.push(Line::from(line));
            }
        } else if line.trim().starts_with('[') {
            config_lines.push(Line::from(Span::styled(
                line,
                Style::default()
                    .fg(Color::Magenta)
                    .add_modifier(Modifier::BOLD),
            )));
        } else {
            config_lines.push(Line::from(line));
        }
    }

    let paragraph = Paragraph::new(config_lines)
        .block(Block::default().borders(Borders::ALL))
        .wrap(Wrap { trim: true });

    frame.render_widget(paragraph, area);
}

/// Render component tab
fn render_component_tab(frame: &mut Frame, area: Rect, app: &App) {
    let component_code = generate_component_code(app);

    let content = vec![
        Line::from(vec![Span::styled(
            "Component Code (unified.rs):",
            Style::default().add_modifier(Modifier::BOLD),
        )]),
        Line::from(""),
    ];

    let mut code_lines = content;
    for line in component_code.lines() {
        // Simple Rust syntax highlighting
        if line.trim().starts_with("//") {
            code_lines.push(Line::from(Span::styled(
                line,
                Style::default().fg(Color::Green),
            )));
        } else if line.contains("use ")
            || line.contains("pub fn")
            || line.contains("struct")
            || line.contains("impl")
        {
            code_lines.push(Line::from(Span::styled(
                line,
                Style::default()
                    .fg(Color::Blue)
                    .add_modifier(Modifier::BOLD),
            )));
        } else if line.contains('"') {
            // Simple string highlighting - split by quotes
            let mut spans = Vec::new();
            let mut in_string = false;
            let mut current = String::new();

            for ch in line.chars() {
                if ch == '"' {
                    if in_string {
                        current.push(ch);
                        spans.push(Span::styled(
                            current.clone(),
                            Style::default().fg(Color::Green),
                        ));
                        current.clear();
                    } else {
                        if !current.is_empty() {
                            spans.push(Span::raw(current.clone()));
                            current.clear();
                        }
                        current.push(ch);
                    }
                    in_string = !in_string;
                } else {
                    current.push(ch);
                }
            }

            if !current.is_empty() {
                if in_string {
                    spans.push(Span::styled(current, Style::default().fg(Color::Green)));
                } else {
                    spans.push(Span::raw(current));
                }
            }

            code_lines.push(Line::from(spans));
        } else {
            code_lines.push(Line::from(line));
        }
    }

    let paragraph = Paragraph::new(code_lines)
        .block(Block::default().borders(Borders::ALL))
        .wrap(Wrap { trim: true });

    frame.render_widget(paragraph, area);
}

/// Render translations tab with multi-language panels
fn render_translations_tab(
    frame: &mut Frame,
    area: Rect,
    app: &App,
    _preview_state: &PreviewState,
) {
    let selected_languages = app.selected_languages();
    if selected_languages.is_empty() {
        let content = vec![Line::from("No languages selected")];
        let paragraph = Paragraph::new(content)
            .block(Block::default().borders(Borders::ALL))
            .alignment(Alignment::Center);
        frame.render_widget(paragraph, area);
        return;
    }

    let title = format!("Translations ({} languages)", selected_languages.len());
    let main_block = Block::default().borders(Borders::ALL).title(title);
    let inner_area = main_block.inner(area);
    frame.render_widget(main_block, area);

    // Create layout for multiple language panels
    match selected_languages.len() {
        1 => {
            // Single language - full width
            render_single_language_panel(frame, inner_area, app, &selected_languages[0]);
        }
        2 => {
            // Two languages - side by side
            let chunks = Layout::default()
                .direction(Direction::Horizontal)
                .constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
                .split(inner_area);

            render_single_language_panel(frame, chunks[0], app, &selected_languages[0]);
            render_single_language_panel(frame, chunks[1], app, &selected_languages[1]);
        }
        3 => {
            // Three languages - first full width, then two below
            let v_chunks = Layout::default()
                .direction(Direction::Vertical)
                .constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
                .split(inner_area);

            render_single_language_panel(frame, v_chunks[0], app, &selected_languages[0]);

            let h_chunks = Layout::default()
                .direction(Direction::Horizontal)
                .constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
                .split(v_chunks[1]);

            render_single_language_panel(frame, h_chunks[0], app, &selected_languages[1]);
            render_single_language_panel(frame, h_chunks[1], app, &selected_languages[2]);
        }
        _ => {
            // 4+ languages - 2x2 grid (showing first 4)
            let v_chunks = Layout::default()
                .direction(Direction::Vertical)
                .constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
                .split(inner_area);

            let top_chunks = Layout::default()
                .direction(Direction::Horizontal)
                .constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
                .split(v_chunks[0]);

            let bottom_chunks = Layout::default()
                .direction(Direction::Horizontal)
                .constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
                .split(v_chunks[1]);

            render_single_language_panel(frame, top_chunks[0], app, &selected_languages[0]);
            render_single_language_panel(frame, top_chunks[1], app, &selected_languages[1]);
            render_single_language_panel(frame, bottom_chunks[0], app, &selected_languages[2]);

            if selected_languages.len() > 4 {
                render_language_overflow_panel(frame, bottom_chunks[1], &selected_languages[3..]);
            } else {
                render_single_language_panel(frame, bottom_chunks[1], app, &selected_languages[3]);
            }
        }
    }
}

/// Render a single language translation panel
fn render_single_language_panel(frame: &mut Frame, area: Rect, app: &App, language: &str) {
    let translation_content = generate_translation_content(app, language);

    let lang_name = match language {
        "en" => "English",
        "es" => "Spanish",
        "fr" => "French",
        "de" => "German",
        "it" => "Italian",
        "pt" => "Portuguese",
        "ja" => "Japanese",
        "zh" => "Chinese",
        "ru" => "Russian",
        code => code,
    };

    let block = Block::default()
        .borders(Borders::ALL)
        .title(format!("{} ({})", lang_name, language));
    let inner_area = block.inner(area);
    frame.render_widget(block, area);

    let mut translation_lines = Vec::new();
    for line in translation_content.lines() {
        // Simple FTL syntax highlighting
        if line.trim().starts_with('#') {
            translation_lines.push(Line::from(Span::styled(
                line,
                Style::default().fg(Color::Green),
            )));
        } else if line.contains('=') {
            let parts: Vec<&str> = line.splitn(2, '=').collect();
            if parts.len() == 2 {
                translation_lines.push(Line::from(vec![
                    Span::styled(
                        parts[0].trim(),
                        Style::default()
                            .fg(Color::Blue)
                            .add_modifier(Modifier::BOLD),
                    ),
                    Span::styled(" = ", Style::default()),
                    Span::styled(parts[1], Style::default().fg(Color::Yellow)),
                ]));
            } else {
                translation_lines.push(Line::from(line));
            }
        } else if line.trim().is_empty() {
            translation_lines.push(Line::from(""));
        } else {
            translation_lines.push(Line::from(line));
        }
    }

    let paragraph = Paragraph::new(translation_lines).wrap(Wrap { trim: true });

    frame.render_widget(paragraph, inner_area);
}

/// Render overflow panel when more than 4 languages are selected
fn render_language_overflow_panel(frame: &mut Frame, area: Rect, remaining_languages: &[String]) {
    let block = Block::default()
        .borders(Borders::ALL)
        .title(format!("+{} more", remaining_languages.len()));
    let inner_area = block.inner(area);
    frame.render_widget(block, area);

    let mut content_lines = vec![
        Line::from(Span::styled(
            "Additional languages:",
            Style::default().add_modifier(Modifier::BOLD),
        )),
        Line::from(""),
    ];

    for lang in remaining_languages.iter().take(8) {
        // Show up to 8 additional
        let lang_name = match lang.as_str() {
            "en" => "English",
            "es" => "Spanish",
            "fr" => "French",
            "de" => "German",
            "it" => "Italian",
            "pt" => "Portuguese",
            "ja" => "Japanese",
            "zh" => "Chinese",
            "ru" => "Russian",
            code => code,
        };
        content_lines.push(Line::from(format!("• {} ({})", lang_name, lang)));
    }

    if remaining_languages.len() > 8 {
        content_lines.push(Line::from(format!(
            "... and {} more",
            remaining_languages.len() - 8
        )));
    }

    let paragraph = Paragraph::new(content_lines).wrap(Wrap { trim: true });

    frame.render_widget(paragraph, inner_area);
}

/// File status for preview
#[derive(Debug, Clone)]
pub enum FileStatus {
    Create, // Will be created
    Update, // Will be updated
    Exists, // Already exists
}

/// Generate list of files that will be created/updated
fn generate_file_list(app: &App) -> Vec<(String, String, FileStatus)> {
    let mut files = Vec::new();

    // Route configuration
    files.push((
        "Route Config".to_string(),
        "content/routes/manager.toml".to_string(),
        FileStatus::Create,
    ));

    // Page module files (if auto-scaffold enabled)
    if app.auto_scaffold {
        let module_name = app.page_name.to_lowercase();
        files.push((
            "Module".to_string(),
            format!("crates/pages/{}/mod.rs", module_name),
            FileStatus::Create,
        ));
        files.push((
            "Component".to_string(),
            format!("crates/pages/{}/unified.rs", module_name),
            FileStatus::Create,
        ));
    }

    // Translation files
    for lang in &app.selected_languages() {
        files.push((
            "Translation".to_string(),
            format!(
                "content/locales/{}/pages/{}.ftl",
                lang,
                app.page_name.to_lowercase()
            ),
            FileStatus::Create,
        ));
    }

    // Library exports (if auto-scaffold enabled)
    if app.auto_scaffold {
        files.push((
            "Exports".to_string(),
            "crates/pages/src/lib.rs".to_string(),
            FileStatus::Update,
        ));
    }

    files
}

/// Generate route configuration TOML
pub fn generate_route_config(app: &App) -> String {
    let _module_name = app
        .page_name
        .chars()
        .enumerate()
        .map(|(i, c)| {
            if i > 0 && c.is_uppercase() {
                format!("_{}", c.to_lowercase())
            } else {
                c.to_lowercase().to_string()
            }
        })
        .collect::<String>();

    format!(
        r#"# Generated route configuration for {}
# Generated by Page Generator

[[routes]]
component = "{}"
path = "{}"
priority = {:.1}
template = "{}"
languages = {:?}
auto_scaffold = {}
replace_existing = {}

# Route metadata
[routes.meta]
title = "{}"
description = "Generated page using {} template"
keywords = []
"#,
        app.page_name,
        app.page_name,
        app.route_path,
        app.priority,
        app.selected_template.as_str(),
        app.selected_languages(),
        app.auto_scaffold,
        app.replace_existing,
        app.page_name,
        app.selected_template.name(),
    )
}

/// Generate component code
pub fn generate_component_code(app: &App) -> String {
    let component_name = &app.page_name;

    match app.selected_template {
        crate::manager::app::PageTemplate::HeroPage => format!(
            r#"//! {} Hero Page Component
//! Generated by Page Generator

use leptos::*;
use crate::i18n::{{use_i18n, Translations}};

#[component]
pub fn {}() -> impl IntoView {{
    let i18n = use_i18n();

    view! {{
        <div class="hero-page">
            <div class="hero-section">
                <h1 class="hero-title">
                    {{move || i18n.t("{}-title")}}
                </h1>
                <p class="hero-subtitle">
                    {{move || i18n.t("{}-subtitle")}}
                </p>
                <div class="hero-actions">
                    <button class="btn btn-primary">
                        {{move || i18n.t("{}-cta-primary")}}
                    </button>
                    <button class="btn btn-secondary">
                        {{move || i18n.t("{}-cta-secondary")}}
                    </button>
                </div>
            </div>
        </div>
    }}
}}
"#,
            component_name,
            component_name,
            app.page_name.to_lowercase(),
            app.page_name.to_lowercase(),
            app.page_name.to_lowercase(),
            app.page_name.to_lowercase(),
        ),
        crate::manager::app::PageTemplate::FormPage => format!(
            r#"//! {} Form Page Component
//! Generated by Page Generator

use leptos::*;
use crate::i18n::{{use_i18n, Translations}};

#[component]
pub fn {}() -> impl IntoView {{
    let i18n = use_i18n();
    let (form_data, set_form_data) = create_signal(String::new());

    let on_submit = move |ev: leptos::ev::SubmitEvent| {{
        ev.prevent_default();
        // Handle form submission
        logging::log!("Form submitted: {{}}", form_data.get());
    }};

    view! {{
        <div class="form-page">
            <h1>{{move || i18n.t("{}-title")}}</h1>
            <form on:submit=on_submit>
                <div class="form-group">
                    <label for="input-field">
                        {{move || i18n.t("{}-field-label")}}
                    </label>
                    <input
                        id="input-field"
                        type="text"
                        prop:value=move || form_data.get()
                        on:input=move |ev| set_form_data.set(event_target_value(&ev))
                        placeholder=move || i18n.t("{}-field-placeholder")
                    />
                </div>
                <button type="submit" class="btn btn-primary">
                    {{move || i18n.t("{}-submit")}}
                </button>
            </form>
        </div>
    }}
}}
"#,
            component_name,
            component_name,
            app.page_name.to_lowercase(),
            app.page_name.to_lowercase(),
            app.page_name.to_lowercase(),
            app.page_name.to_lowercase(),
        ),
        crate::manager::app::PageTemplate::ContentList => format!(
            r#"//! {} Content List Component
//! Generated by Page Generator

use leptos::*;
use crate::i18n::{{use_i18n, Translations}};

#[component]
pub fn {}() -> impl IntoView {{
    let i18n = use_i18n();
    let (filter, set_filter) = create_signal(String::new());

    // Mock data - replace with actual content loading
    let items = vec![
        "Item 1".to_string(),
        "Item 2".to_string(),
        "Item 3".to_string(),
    ];

    let filtered_items = move || {{
        let filter_val = filter.get().to_lowercase();
        items.iter()
            .filter(|item| item.to_lowercase().contains(&filter_val))
            .cloned()
            .collect::<Vec<_>>()
    }};

    view! {{
        <div class="content-list-page">
            <h1>{{move || i18n.t("{}-title")}}</h1>

            <div class="content-filter">
                <input
                    type="text"
                    prop:value=move || filter.get()
                    on:input=move |ev| set_filter.set(event_target_value(&ev))
                    placeholder=move || i18n.t("{}-filter-placeholder")
                />
            </div>

            <div class="content-grid">
                <For
                    each=move || filtered_items()
                    key=|item| item.clone()
                    children=move |item| {{
                        view! {{
                            <div class="content-item">
                                <h3>{{item}}</h3>
                            </div>
                        }}
                    }}
                />
            </div>
        </div>
    }}
}}
"#,
            component_name,
            component_name,
            app.page_name.to_lowercase(),
            app.page_name.to_lowercase(),
        ),
        crate::manager::app::PageTemplate::BasicPage => format!(
            r#"//! {} Basic Page Component
//! Generated by Page Generator

use leptos::*;
use crate::i18n::{{use_i18n, Translations}};

#[component]
pub fn {}() -> impl IntoView {{
    let i18n = use_i18n();

    view! {{
        <div class="basic-page">
            <h1>{{move || i18n.t("{}-title")}}</h1>
            <div class="page-content">
                <p>{{move || i18n.t("{}-content")}}</p>
            </div>
        </div>
    }}
}}
"#,
            component_name,
            component_name,
            app.page_name.to_lowercase(),
            app.page_name.to_lowercase(),
        ),
    }
}

/// Generate translation content for a specific language
pub fn generate_translation_content(app: &App, lang: &str) -> String {
    let key_prefix = app.page_name.to_lowercase();

    let base_content = match app.selected_template {
        crate::manager::app::PageTemplate::HeroPage => format!(
            r#"# {} Hero Page Translations
# Generated by Page Generator

{}-title = {} Page
{}-subtitle = Welcome to the {} page
{}-cta-primary = Get Started
{}-cta-secondary = Learn More
"#,
            app.page_name,
            key_prefix,
            app.page_name,
            key_prefix,
            app.page_name,
            key_prefix,
            key_prefix,
        ),
        crate::manager::app::PageTemplate::FormPage => format!(
            r#"# {} Form Page Translations
# Generated by Page Generator

{}-title = {} Form
{}-field-label = Enter Information
{}-field-placeholder = Type here...
{}-submit = Submit Form
"#,
            app.page_name, key_prefix, app.page_name, key_prefix, key_prefix, key_prefix,
        ),
        crate::manager::app::PageTemplate::ContentList => format!(
            r#"# {} Content List Translations
# Generated by Page Generator

{}-title = {} List
{}-filter-placeholder = Filter items...
"#,
            app.page_name, key_prefix, app.page_name, key_prefix,
        ),
        crate::manager::app::PageTemplate::BasicPage => format!(
            r#"# {} Basic Page Translations
# Generated by Page Generator

{}-title = {}
{}-content = This is the {} page content.
"#,
            app.page_name, key_prefix, app.page_name, key_prefix, app.page_name,
        ),
    };

    // Add language-specific variations
    match lang {
        "es" => base_content
            .replace(" Page", " Página")
            .replace("Get Started", "Comenzar")
            .replace("Learn More", "Saber Más")
            .replace("Enter Information", "Ingrese Información")
            .replace("Type here...", "Escriba aquí...")
            .replace("Submit Form", "Enviar Formulario")
            .replace("Filter items...", "Filtrar elementos...")
            .replace(" List", " Lista")
            .replace("This is the", "Esta es la página de"),
        _ => base_content,
    }
}
