import { Node } from 'web-tree-sitter';
import { ExportMetadata } from '@scandiumsys/owstra-types';

export abstract class BaseIndexer {
  /**
   * The language this indexer handles (e.g., 'javascript').
   */
  public abstract readonly language: string;

  /**
   * Extract all exported symbols from a file's root node.
   */
  public abstract extractExports(root: Node, filePath: string): ExportMetadata[];

  /**
   * Extract all imports from a file's root node to build the local import map.
   * Key: local name, Value: source path.
   */
  public abstract extractImports(root: Node): Record<string, string>;

  /**
   * Extract all function calls from a file's root node.
   * Key: function name, Value: array of argument positions (for deep tracing).
   */
  public abstract extractCalls(root: Node): Array<{ name: string, argPositions: Array<{ row: number; column: number }> }>;
}
