//! Configuration types

use std::collections::HashMap;

use serde::{Deserialize, Serialize};

use crate::ContentFeatures;

/// Content configuration for a specific content type
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ContentConfig {
    /// Content type name
    pub name: String,
    /// Content directory path
    pub directory: String,
    /// Whether this content type is enabled
    pub enabled: bool,
    /// Whether this is the default content type
    pub is_default: Option<bool>,
    /// Features enabled for this content type
    pub features: Option<ContentFeatures>,
    /// Path to locales for this content type
    pub locales_path: std::path::PathBuf,
}

impl ContentConfig {
    /// Create a basic content config from environment variables
    pub fn from_env() -> Self {
        let content_dir =
            std::env::var("SITE_CONTENT_PATH").unwrap_or_else(|_| "site/content".to_string());
        let locales_dir =
            std::env::var("SITE_I18N_PATH").unwrap_or_else(|_| "site/i18n/locales".to_string());

        Self {
            name: "default".to_string(),
            directory: content_dir,
            enabled: true,
            is_default: Some(true),
            features: Some(ContentFeatures::default()),
            locales_path: std::path::PathBuf::from(locales_dir),
        }
    }
}
