import type { ViralutionParameter, ViralutionRelationship } from "./data";
/**
 * Main entity to store a whole model data - Optimized DataTree with flat key-value storage
 * - Memory efficient: Uses flat Map instead of nested objects
 * - Fast queries: O(1) element lookup, O(n) search
 * - Lazy search index: Only builds trie when search is called
 */
export declare class DataTree {
    private _elementMap;
    private _relationships;
    get relationships(): ViralutionRelationship[];
    private _searchIndex;
    private _searchIndexBuilt;
    get elementData(): {
        [key: number]: {
            [key: string]: ViralutionParameter;
        };
    }[];
    constructor(elementData?: {
        [key: number]: {
            [key: string]: ViralutionParameter;
        };
    }[], treeNode?: SerializedTreeNode);
    /**
     * Add elements to the data tree (batch operation)
     * @param data Object with elementId as key
     */
    addElements(data: {
        [key: number]: {
            [key: string]: ViralutionParameter;
        };
    }): void;
    addRelationships(relationships: ViralutionRelationship[]): void;
    /**
     * Get element data by ID - O(1) lookup
     */
    getObjectByKey(key: number): {
        [key: string]: ViralutionParameter;
    } | null;
    /**
     * Get all element IDs
     */
    getElementIds(): number[];
    /**
     * Get element count
     */
    get size(): number;
    /**
     * Get all elements with their data
     * @returns Array of { elementId, data } objects
     */
    getAllElements(): {
        elementId: number;
        data: {
            [key: string]: ViralutionParameter;
        };
    }[];
    /**
     * Get all elements as a Map (more efficient for large datasets)
     * @returns Map<elementId, elementData>
     */
    getAllElementsMap(): Map<number, {
        [key: string]: ViralutionParameter;
    }>;
    /**
     * Iterate over all elements without creating intermediate arrays
     * More memory efficient for large datasets
     * @param callback Function to call for each element
     */
    forEachElement(callback: (elementId: number, data: {
        [key: string]: ViralutionParameter;
    }) => void): void;
    /**
     * Search for elements containing the query string
     * Builds search index lazily on first search
     */
    search(query: string): number[];
    /**
     * Build inverted index for search
     * Maps: "search term" -> Set<elementId>
     */
    private _buildSearchIndex;
    /**
     * Rebuild search index from serialized worker result
     */
    private _rebuildSearchIndexFromSerialized;
    /**
     * Clear search index to free memory
     */
    clearSearchIndex(): void;
    /**
     * Dispose and clear all data
     */
    dispose(): void;
    private _outEdges;
    private _inEdges;
    private _edgesByType;
    INVERSE: Record<string, string>;
    buildGraphIndex(): void;
    getLinkedElements(id: number): number[];
    getNeighborsByType(id: number, type: string): number[];
    /**
     * Get all level/storey IDs in this model.
     * Uses HAS_LEVEL relationships (building→storey) from both Revit and IFC.
     * Falls back to collecting unique ToId from ON_LEVEL relationships.
     */
    getLevels(): number[];
    /**
     * Get all room/space IDs in this model.
     * Uses HAS_ROOM relationships (storey→room) from both Revit and IFC.
     * Falls back to collecting unique ToId from IN_SPACE relationships.
     */
    getRooms(): number[];
    /**
     * Get all element IDs on a specific level.
     * Uses ON_LEVEL relationships (element→level) via the inverse index.
     */
    getElementsByLevel(levelId: number): number[];
    /**
     * Get all room IDs on a specific level.
     * Uses HAS_ROOM relationships (storey→room) from the outgoing edges.
     */
    getRoomsByLevel(levelId: number): number[];
    /**
     * Calculate hierarchical depth for nodes using BFS from root nodes
     * Root nodes (no incoming edges) get level 0, their children get level 1, etc.
     * Supports multiple root nodes and ensures every node gets a level.
     * @param edges Graph edges
     * @param allNodeIds Optional array of all node IDs to ensure isolated nodes get levels
     * @returns Map of node ID to hierarchical level
     */
    private _calculateNodeLevels;
    toGraph(layoutOptions?: GraphLayoutOptions): {
        nodes: GraphNode[];
        edges: GraphEdge[];
    };
    /**
     * Async version of toGraph() that uses Web Worker for layout computation
     * Non-blocking - layout is computed in a background thread
     * @param layoutOptions Layout options
     * @returns Promise that resolves with nodes and edges
     */
    toGraphAsync(layoutOptions?: GraphLayoutOptions, onProgress?: (progress: {
        phase: string;
        percent: number;
        current: number;
        total: number;
    }) => void): Promise<{
        nodes: GraphNode[];
        edges: GraphEdge[];
    }>;
    /**
     * Compute force-directed layout positions for nodes
     * Uses Fruchterman-Reingold algorithm
     */
    private _computeForceDirectedLayout;
    /**
     * Simple string hash for deterministic seeding
     */
    private _hashString;
    /**
     * Seeded random number generator (deterministic)
     */
    private _seededRandom;
}
export interface SerializedTreeNode {
    children: {
        [char: string]: SerializedTreeNode;
    };
    keys: number[];
}
export declare class TreeNode {
    children: Map<string, TreeNode>;
    keys: Set<number>;
}
/**
 * Options for graph layout computation
 */
interface GraphLayoutOptions {
    width?: number;
    height?: number;
    iterations?: number;
    seed?: number;
    boundaryShape?: "rectangular" | "circular";
}
type GraphNode = {
    id: string;
    label: string;
    group?: string;
    x: number;
    y: number;
    level?: number;
};
type GraphEdge = {
    id: string;
    source: string;
    target: string;
    type: string;
};
export {};
