//! Routing type definitions and structures
//!
//! This module contains the core data structures and traits used throughout
//! the unified routing system.

use super::utils::AlternateUrl;

/// Core routing trait for components that can be rendered
pub trait Routable {
    /// Render the component for the given path
    fn render(&self, path: &str) -> String;

    /// Get the title for this route
    fn get_title(&self, language: &str) -> String;

    /// Check if this route matches the given path
    fn matches(&self, path: &str) -> bool;
}

/// Route metadata for SEO and navigation
#[derive(Debug, Clone, PartialEq)]
pub struct RouteMetadata {
    pub path: String,
    pub title: String,
    pub description: String,
    pub keywords: Vec<String>,
    pub language: String,
    pub canonical_url: Option<String>,
    pub alternate_urls: Vec<AlternateUrl>,
}

impl RouteMetadata {
    pub fn new(path: &str, language: &str) -> Self {
        Self {
            path: path.to_string(),
            title: String::new(),
            description: String::new(),
            keywords: Vec::new(),
            language: language.to_string(),
            canonical_url: None,
            alternate_urls: Vec::new(),
        }
    }

    pub fn with_title(mut self, title: &str) -> Self {
        self.title = title.to_string();
        self
    }

    pub fn with_description(mut self, description: &str) -> Self {
        self.description = description.to_string();
        self
    }

    pub fn with_keywords(mut self, keywords: Vec<&str>) -> Self {
        self.keywords = keywords.into_iter().map(|k| k.to_string()).collect();
        self
    }
}

/// Navigation data structure
#[derive(Debug, Clone)]
pub struct NavigationData {
    pub current_path: String,
    pub language: String,
    pub breadcrumbs: Vec<super::utils::BreadcrumbItem>,
    pub is_not_found: bool,
}
