import type { AgencyConfig } from "./config.js";
import type { AgencyProgram, FunctionParameter, Tag, TypeParam, ValueParam, VariableType } from "./types.js";
import type { SourceLocation } from "./types/base.js";
import type { ImportNodeStatement, ImportStatement } from "./types/importStatement.js";
import type { ExportFromStatement } from "./types/exportFromStatement.js";
export type InterruptKind = {
    kind: string;
};
/** Marker on a SymbolInfo that entered FileSymbols via an `export from` re-export. */
export type ReExportedFrom = {
    sourceFile: string;
    originalName: string;
};
export type FunctionSymbol = {
    kind: "function";
    name: string;
    loc?: SourceLocation;
    safe: boolean;
    exported: boolean;
    parameters: FunctionParameter[];
    returnType: VariableType | null;
    returnTypeValidated?: boolean;
    interruptKinds?: InterruptKind[];
    reExportedFrom?: ReExportedFrom;
};
export type NodeSymbol = {
    kind: "node";
    name: string;
    loc?: SourceLocation;
    parameters: FunctionParameter[];
    returnType: VariableType | null;
    returnTypeValidated?: boolean;
    exported?: boolean;
    interruptKinds?: InterruptKind[];
    reExportedFrom?: ReExportedFrom;
};
export type TypeSymbol = {
    kind: "type";
    name: string;
    loc?: SourceLocation;
    exported: boolean;
    aliasedType: VariableType;
    /** Type parameters for generic aliases (e.g., `T` in `type Container<T> = ...`). */
    typeParams?: TypeParam[];
    /** Value parameters for value-parameterized aliases (e.g. `low` and `high`
     * in `type NumberInRange(low: number, high: number) = number`).
     * Carried through imports/re-exports alongside `typeParams`. */
    valueParams?: ValueParam[];
    /** `@validate(...)` / `@jsonSchema(...)` annotations declared above the alias.
     * Carried through imports/re-exports so annotation metadata flows across modules. */
    tags?: Tag[];
    reExportedFrom?: ReExportedFrom;
};
export type ConstantSymbol = {
    kind: "constant";
    name: string;
    loc?: SourceLocation;
    exported: boolean;
    reExportedFrom?: ReExportedFrom;
};
export type SymbolInfo = FunctionSymbol | NodeSymbol | TypeSymbol | ConstantSymbol;
export type SymbolKind = SymbolInfo["kind"];
/** Maps symbol name → info for a single file. */
export type FileSymbols = Record<string, SymbolInfo>;
/**
 * One named symbol resolved through an import: where it lives, what name
 * the importing file uses, and what it actually is.
 */
export type ResolvedImport = {
    file: string;
    originalName: string;
    localName: string;
    symbol: SymbolInfo;
};
/**
 * Cross-file index of every declaration reachable from an entrypoint.
 * Built eagerly: parses every reachable .agency file, classifies its
 * top-level (and nested type-alias) declarations, and follows imports.
 */
export declare class SymbolTable {
    private readonly files;
    constructor(files?: Record<string, FileSymbols>);
    static build(entrypoint: string, config?: AgencyConfig): SymbolTable;
    has(absPath: string): boolean;
    getFile(absPath: string): FileSymbols | undefined;
    filePaths(): string[];
    /**
     * Walk every file looking for a type alias with the given name. Returns
     * the first match in iteration order. Used to surface imported type
     * definitions for Zod schema generation.
     */
    findTypeAcrossFiles(name: string): SymbolInfo | undefined;
    /**
     * Resolve every named symbol in an import statement to its source file
     * + SymbolInfo. Skips namespace and default imports. Returns [] for
     * non-Agency imports.
     */
    resolveImport(stmt: ImportStatement, fromFile: string): ResolvedImport[];
    resolveImportedNodes(stmt: ImportNodeStatement, fromFile: string): ResolvedImport[];
}
/**
 * Walk the top-level program node list to find `@tag(...)` nodes
 * sitting directly above type aliases, returning a map from alias name
 * to its pending tag list. This mirrors what the TypescriptPreprocessor's
 * `attachTags` does later in the pipeline, but happens early so symbol
 * table consumers (other modules that import this alias) see annotations
 * attached to the TypeSymbol.
 *
 * Pre-pass only, no mutation: keeps SymbolTable.build idempotent and
 * decoupled from the preprocessor.
 */
export declare function collectTypeAliasTags(program: AgencyProgram): Record<string, Tag[]>;
/**
 * Classify symbols in a parsed Agency program.
 * Uses walkNodes to find symbols at all nesting levels (e.g. type aliases inside functions).
 */
export declare function classifySymbols(program: AgencyProgram): FileSymbols;
/**
 * Merge symbols flowing through one `exportFromStatement` from `sourcePath`
 * into the re-exporter's `FileSymbols`. Hard errors on missing symbols,
 * non-exported sources, and collisions.
 */
export declare function mergeExportsFrom(files: Record<string, FileSymbols>, reExporterPath: string, sourcePath: string, stmt: ExportFromStatement): void;
