//! Embedded directory structure generation
//!
//! Handles creation of the embedded/ directory structure:
//! - embedded/configs/
//! - embedded/models/

use anyhow::Result;
use std::path::Path;

/// Embedded template generator
pub struct EmbeddedTemplates;

impl EmbeddedTemplates {
    /// Create a new EmbeddedTemplates instance
    pub fn new() -> Self {
        Self
    }

    /// Create embedded directory structure
    ///
    /// Creates the following structure:
    /// ```text
    /// embedded/
    /// ├── configs/
    /// │   └── .gitkeep
    /// └── models/
    ///     └── .gitkeep
    /// ```
    pub async fn create_structure(&self, path: &Path) -> Result<()> {
        let embedded_dir = path.join("embedded");
        tokio::fs::create_dir_all(&embedded_dir).await?;

        // Create configs subdirectory with .gitkeep
        let configs_dir = embedded_dir.join("configs");
        tokio::fs::create_dir_all(&configs_dir).await?;
        tokio::fs::write(configs_dir.join(".gitkeep"), "").await?;

        // Create models subdirectory with .gitkeep
        let models_dir = embedded_dir.join("models");
        tokio::fs::create_dir_all(&models_dir).await?;
        tokio::fs::write(models_dir.join(".gitkeep"), "").await?;

        Ok(())
    }
}

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