use serde::{Deserialize, Serialize};
pub type SymbolId = String;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Symbol {
pub id: SymbolId,
pub name: String,
pub kind: SymbolKind,
pub language: Language,
pub file: String,
pub line_start: u32,
pub line_end: u32,
pub signature: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub enum SymbolKind {
Class,
Interface,
TypeAlias,
Function,
Method,
Property,
Variable,
Module,
Enum,
EnumVariant,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub enum Language {
TypeScript,
JavaScript,
Python,
Rust,
Go,
Java,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Relationship {
pub from: SymbolId,
pub to: SymbolId,
pub kind: RelationshipKind,
pub alias: Option<String>,
pub properties_accessed: Vec<String>,
pub context: String,
pub file: String,
pub line: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub enum RelationshipKind {
Imports,
Calls,
Extends,
Implements,
UsesType,
AccessesProperty,
ReExports,
Instantiates,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FileIR {
pub file: String,
pub language: Language,
pub symbols: Vec<Symbol>,
pub relationships: Vec<Relationship>,
pub parse_errors: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RepoIR {
pub root: String,
pub files: Vec<FileIR>,
pub language_stats: std::collections::HashMap<String, usize>,
}