//! Basic type definitions and core framework types

use std::collections::HashMap;

use serde::{Deserialize, Serialize};

// Re-use LanguageCode from routing
use crate::i18n::{LanguageConfig, TextDirection};
use crate::routing::LanguageCode;
use crate::ThemeConfig;

/// Site configuration
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SiteConfig {
    /// Site name/title
    pub name: String,
    /// Site description
    pub description: String,
    /// Site base URL
    pub base_url: String,
    /// Default language
    pub default_language: LanguageCode,
    /// Available languages
    pub languages: Vec<LanguageConfig>,
    /// Default theme
    pub default_theme: String,
    /// Available themes
    pub themes: Vec<ThemeConfig>,
    /// Contact email
    pub contact_email: Option<String>,
    /// Additional site metadata
    pub metadata: HashMap<String, String>,
}

impl Default for SiteConfig {
    fn default() -> Self {
        Self {
            name: "Rustelo Site".to_string(),
            description: "A Rustelo-powered website".to_string(),
            base_url: "http://localhost:3000".to_string(),
            default_language: "en".to_string(),
            languages: vec![LanguageConfig {
                code: "en".to_string(),
                name: "English".to_string(),
                english_name: "English".to_string(),
                direction: TextDirection::LeftToRight,
                is_default: true,
                is_enabled: true,
                url_prefix: "".to_string(),
            }],
            default_theme: "default".to_string(),
            themes: vec![ThemeConfig {
                id: "default".to_string(),
                name: "Default Theme".to_string(),
                description: Some("Default Rustelo theme".to_string()),
                primary_color: "#007acc".to_string(),
                secondary_color: "#6c757d".to_string(),
                css_variables: HashMap::new(),
                is_dark: false,
            }],
            contact_email: None,
            metadata: HashMap::new(),
        }
    }
}
