use std::collections::HashMap;

use serde::{Deserialize, Serialize};

use crate::ContentConfig;

/// Registry for content types/kinds
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ContentKindRegistry {
    /// Available content kinds
    pub kinds: HashMap<String, ContentConfig>,
}

impl ContentKindRegistry {
    /// Create new empty registry
    pub fn new() -> Self {
        Self {
            kinds: HashMap::new(),
        }
    }

    /// Register a new content kind
    pub fn register(&mut self, kind: String, config: ContentConfig) {
        self.kinds.insert(kind, config);
    }
}

impl Default for ContentKindRegistry {
    fn default() -> Self {
        Self::new()
    }
}
