import { Logger, FhirPackageIdentifier, FhirVersion, FileInPackageIndex, FileIndexEntryWithPkg } from '@outburn/types';
export { FileInPackageIndex, FileIndexEntryWithPkg } from '@outburn/types';

interface ExplorerConfig {
    logger?: Logger;
    registryUrl?: string;
    registryToken?: string;
    cachePath?: string;
    context: Array<string | FhirPackageIdentifier>;
    skipExamples?: boolean;
    /** Max number of full resource content entries to keep in memory. Default: 500. */
    contentCacheSize?: number;
    /** Max number of full package index lists to keep in memory. Default: 500. */
    indexCacheSize?: number;
    /** Max number of fast index keys to keep in memory. Default: 10000. */
    fastIndexSize?: number;
    /**
     * FHIR version to use when auto-adding core package if none is found in context.
     * Defaults to '4.0.1'.
     * Supports: '3.0.2', '3.0', 'R3' (STU3), '4.0.1', '4.0' (R4), '4.3.0', '4.3' (R4B), '5.0.0', '5.0' (R5)
     * If specified and no core package exists in context, automatically adds the appropriate hl7.fhir.rX.core package.
     */
    fhirVersion?: FhirVersion;
}
interface LookupFilter extends Partial<FileInPackageIndex> {
    package?: string | FhirPackageIdentifier;
}

declare class FhirPackageExplorer {
    private fpi;
    private cachePath;
    private logger;
    private indexCache;
    private contentCache;
    private fastIndex;
    private contextPackages;
    private normalizedRootPackages;
    private dependencyRootByPackageKey;
    private skipExamples;
    static create(config: ExplorerConfig): Promise<FhirPackageExplorer>;
    private constructor();
    getCachePath(): string;
    getLogger(): Logger;
    getContextPackages(): FhirPackageIdentifier[];
    /**
     * Get the list of direct package dependencies for a given package.
     * @param pkg - The package to expand. Can be a string or a FhirPackageIdentifier object.
     * @returns - A promise that resolves to an array of FhirPackageIdentifier objects.
     */
    getDirectDependencies(pkg: string | FhirPackageIdentifier): Promise<FhirPackageIdentifier[]>;
    /**
     * Expands the package into a list of packages including all transitive dependencies.
     * @param pkg - The package to expand. Can be a string or a FhirPackageIdentifier object.
     * @returns - A promise that resolves to an array of FhirPackageIdentifier objects representing the expanded packages.
     */
    expandPackageDependencies(pkg: string | FhirPackageIdentifier): Promise<FhirPackageIdentifier[]>;
    lookup(filter?: LookupFilter): Promise<any[]>;
    lookupMeta(filter?: LookupFilter): Promise<FileIndexEntryWithPkg[]>;
    resolve(filter?: LookupFilter): Promise<any>;
    resolveMeta(filter?: LookupFilter): Promise<FileIndexEntryWithPkg>;
    /**
     * Get the manifest (package.json) for a given FHIR package.
     * Returns the parsed manifest object for the specified package, or throws if not found.
     *
     * @param pkg - The package to fetch the manifest for (string or FhirPackageIdentifier).
     * @returns A promise that resolves to the manifest (package.json) object for the package.
     */
    getPackageManifest(pkg: string | FhirPackageIdentifier): Promise<any>;
    private _loadContext;
    private _getDependencyRoot;
    private _collectDependencies;
    private _collectDependencyObjects;
    private _getFilePath;
    private _buildFastIndex;
    /**
     * Get the normalized minimal set of root packages from the context.
     * Returns only the root packages that are not dependencies of other root packages,
     * effectively removing redundant entries from the originally provided context.
     *
     * @returns An array of FhirPackageIdentifier objects representing the minimal root packages.
     */
    getNormalizedRootPackages(): FhirPackageIdentifier[];
}

export { type ExplorerConfig, FhirPackageExplorer, type LookupFilter };
