use std::path::Path;

use crate::error::CoreError;
use crate::models::graph::{CodeEdge, CodeNode};

/// Output from parsing a single file
#[derive(Debug, Default)]
pub struct ParseOutput {
    pub nodes: Vec<CodeNode>,
    pub edges: Vec<CodeEdge>,
}

/// Trait for language-specific code parsers
#[allow(async_fn_in_trait)]
pub trait LanguageParser: Send + Sync {
    /// Language name (e.g., "rust", "python", "javascript")
    fn language(&self) -> &str;

    /// File extensions this parser handles
    fn extensions(&self) -> &[&str];

    /// Parse a single file and extract nodes + edges
    fn parse_file(
        &self,
        file_path: &Path,
        source: &str,
        repo_id: &str,
        graph_build_id: &str,
    ) -> Result<ParseOutput, CoreError>;
}
