import { Materials } from './materials';
import { Discipline } from './discipline';
import { BimChangeIfc } from './bim-api-client';
import { BimPropertySetRepository } from './bim-property-set-repository';
import { BimIfcLoaderElement, BimIfcLoaderElementCreateFailure, IBimIfcLoaderElement } from './bim-ifc-loader-element';
import { T8BimIfcLoaderElementCreateFailure } from './T8BimIfcLoaderElement';
import { BimVertexDataRepository } from './bim-vertex-data-repository';
import { BimIfcObject, BimIfcObjectForEachAction, BimIfcSpace, BimIfcBuildingStorey, DefaultBimIfcObjectForEachPredicate, BimIfcObjectForEachPredicate } from './bim-ifc-object';
import { Vector3, BoundingInfo, DeepImmutable } from './babylonjs-import';
import { BimIfcClass } from './bim-ifc-class';
import { BimCoreApiClient } from './client/BimCoreApiClient';
import { GeometryBuilderOptions, IfcGeometryBuilder } from './IfcGeometryBuilder';
import { GeometryBuilderRenderControl } from './GeometryBuilderRenderControl';
import { BimGeometricFeaturesRepository } from './bim-geometric-features-repository';
import type { ListTwinItem, TwinGet } from '@twinfinity/twin';
/**
 * Represents a BIM IFC Loader.
 * Responsible for managing a collection of IFC files and loading data from them.
 */
export interface BimIfcLoaderElementParent {
    /**
     * Gets the floors (IfcBuildingStorey) available in the currently loaded IFC files.
     * @returns An array of {@link BimIfcBuildingStorey} objects representing the available floors (storey levels).
     */
    readonly floors: BimIfcBuildingStorey[];
    /**
     * Gets the spaces (IfcSpace) available in the currently loaded IFC files.
     * @returns An array of {@link BimIfcSpace} objects.
     */
    readonly spaces: BimIfcSpace[];
    /**
     * Gets all the IFC classes used by IFC products in the currently loaded IFC files.
     * @returns An array of {@link BimIfcClass} objects representing the available classes.
     */
    readonly classes: BimIfcClass[];
    /**
     * Gets the available disciplines.
     * @returns An array of Discipline objects.
     */
    readonly disciplines: Discipline[];
    /**
     * Gets the IfcProject root nodes from each loaded IFC file.
     * @remarks
     * These can then be used to traverse the IFC file structure by calling {@link BimIfcObject.foreach}, or {@link BimIfcObject.entries} on each project.
     * @returns An array of BimIfcObject representing the projects.
     */
    readonly projects: BimIfcObject[];
    /**
     * Gets the {@link IBimIfcLoaderElement} for the loaded IFC files.
     * @returns An array of {@link IBimIfcLoaderElement} objects.
     */
    readonly loaderElements: IBimIfcLoaderElement[];
    /**
     * Creates an {@link IfcGeometryBuilder} containing the {@link BimIfcObject} instances matched by the provided predicate.
     * If no predicate is provided, all objects will be included.
     * @remarks
     * The {@link IfcGeometryBuilder} can be used to create {@link Geometry3d} instances for the matched objects. In order to visualize them
     * use {@link TwinfinityViewer.addOrReplaceMesh}.
     *
     * @param options - Optional predicate function to filter the objects.
     * @returns A promise that resolves to an instance of {@link IfcGeometryBuilder}.
     */
    geometryBuilder(options?: ((ifcProduct: BimIfcObject) => unknown) | GeometryBuilderOptions): Promise<IfcGeometryBuilder>;
    /**
     * Adds or retrieves the cached set of {@link BimIfcObject} instances based on the provided key and predicate. Cache is cleared when {@link clear} is called.
     * @template T - The type of {@link BimIfcObject} to be stored in the cache.
     * @param key - The key used to identify the cache entry.
     * @param predicate - The predicate function used to filter {@link BimIfcObject} instances. If it returns `truthy` then object is added to cache. Otherwise not
     * @returns The cached set of {@link BimIfcObject} instances.
     */
    addOrGetIfcProductCache<T extends BimIfcObject = BimIfcObject>(key: string, predicate: BimIfcObjectForEachPredicate): DeepImmutable<Set<T>>;
    /**
     * Deletes a cache created by {@link addOrGetIfcProductCache}-
     * @param key Cache to delete
     * @returns `true` if a cache was deleted, otherwise `false`.
     */
    deleteIfcProductCache(key: string): boolean;
    /**
     * Clears the state of the {@link BimIfcLoader} instance.
     * If {@link geometryBuilder} has been called, and if it has been use to create {@link Geometry3d} instances
     * that have been added to {@link TwinfinityViewer} then those instances are NOT removed from the viewer.
     * Call {@link BimCoreApi.clear} to remove all geometry from the viewer as well.
     */
    clear(): void;
}
/**
 * Represents the data structure for loading an IFC file with additional options.
 */
export interface IfcWithOptions extends BimChangeIfc {
    /**
     * The transformation to be applied to the loaded IFC file.
     * This is useful for positioning the IFC file in the world.
     */
    transform?: BimIfcLoaderElement['transform'];
    /**
     * Extra options for loading the IFC file.
     * Normally used to prevent geometry being loaded for certain IFC objects or to set the visibility of IFC objects.
     */
    loadOptions?: BimIfcLoaderElement['loadOptions'];
}
/**
 * Input for loading a twin into the IFC loader.
 * When passed to {@link BimIfcLoader.add}, the twin is resolved into an {@link IfcWithOptions}
 * via the configured {@link TwinInputResolver}.
 */
export declare class TwinInput {
    readonly twinId: string;
    readonly version?: number | undefined;
    readonly transform?: IfcWithOptions['transform'];
    constructor(twinId: string, version?: number | undefined, transform?: IfcWithOptions['transform']);
    static create(twin: TwinGet | ListTwinItem, options?: {
        transform?: IfcWithOptions['transform'];
        latestVersion?: boolean;
    }): TwinInput;
}
/**
 * Resolves a {@link TwinInput} into an {@link IfcWithOptions} by fetching twin metadata
 * and constructing the necessary resource URLs.
 */
export type TwinInputResolver = (input: TwinInput) => Promise<IfcWithOptions>;
/** Input accepted by {@link BimIfcLoader.add}. Either a direct IFC resource or a twin reference. */
export type IfcAddInput = IfcWithOptions | TwinInput;
/** Type guard to check if an {@link IfcAddInput} is a {@link TwinInput}. */
export declare function isTwinInput(input: IfcAddInput): input is TwinInput;
/**
 * Represents a BIM IFC Loader.
 * Responsible for managing a collection of IFC files and loading data from them.
 */
export declare class BimIfcLoader implements BimIfcLoaderElementParent {
    private readonly _bimApi;
    private readonly _propertySetRepository;
    private readonly _geometricFeaturesRepository;
    readonly vertexDataRepository: BimVertexDataRepository;
    private readonly _materials;
    private readonly _twinInputResolver?;
    private readonly _renderControl?;
    private readonly _availableClasses;
    private readonly _availableFloors;
    private readonly _availableSpaces;
    private readonly _availableDisciplines;
    private readonly _ifcLoaderElements;
    private readonly _projects;
    private readonly _ifcProductCache;
    private readonly _regionBoundingInfo;
    private _ifcProductsWithGeometryCount;
    private readonly _loadedIfcChanges;
    /**
     * Creates a instance of {@link BimIfcLoader} class.
     * Responsible for managing a collection of IFC files and loading data from them.
     */
    constructor(_bimApi: BimCoreApiClient, _propertySetRepository: BimPropertySetRepository, _geometricFeaturesRepository: BimGeometricFeaturesRepository, vertexDataRepository: BimVertexDataRepository, _materials: Materials, _twinInputResolver?: TwinInputResolver | undefined, _renderControl?: GeometryBuilderRenderControl | undefined);
    /**
     * Gets the floors (IfcBuildingStorey) available in the currently loaded IFC files.
     * @returns An array of {@link BimIfcBuildingStorey} objects representing the available floors (storey levels).
     */
    get floors(): BimIfcBuildingStorey[];
    /**
     * Gets the spaces (IfcSpace) available in the currently loaded IFC files..
     * @returns An array of {@link BimIfcSpace} objects.
     */
    get spaces(): BimIfcSpace[];
    /**
     * Gets all the IFC classes used by IFC products in the currently loaded IFC files.
     * @returns An array of {@link BimIfcClass} objects representing the available classes.
     */
    get classes(): BimIfcClass[];
    /**
     * Gets the available disciplines.
     * @returns An array of Discipline objects.
     */
    get disciplines(): Discipline[];
    /**
     * Gets the IfcProject root nodes from each loaded IFC file.
     * @remarks
     * These can then be used to traverse the IFC file structure by calling {@link BimIfcObject.foreach}, or {@link BimIfcObject.entries} on each project.
     * @returns An array of BimIfcObject representing the projects.
     */
    get projects(): BimIfcObject[];
    /**
     * Gets the array of {@link BimChangeIfc} objects representing the IFC files that are loaded.
     *
     * @returns An array of {@link BimChangeIfc} objects.
     */
    get ifcHttpResources(): BimChangeIfc[];
    /**
     * Gets the count of IFC products with geometry.
     * @returns The number of IFC products with geometry.
     */
    get ifcProductsWithGeometryCount(): number;
    /**
     * Gets the {@link IBimIfcLoaderElement} for the loaded IFC files.
     * @returns An array of {@link IBimIfcLoaderElement} objects.
     */
    get loaderElements(): IBimIfcLoaderElement[];
    /**
     * Get the bounding info for loaded IFC files based on the most populated regions of each IFC file, excluding outliers and anomalous regions.
     * The bounding info is derived from the regions with the highest IFC product count in each IFC file. Regions distant from the majority are excluded.
     * The `regionBoundingInfo` is critical for camera positioning to ensure the entire `regionBoundingInfo` is within the camera's frustum.
     * Overly large `regionBoundingInfo` can result in the camera being too distant, causing visibility issues.
     * This can occur if anomalies are undetectable, e.g., when 50% of regions are proximate while the remaining 50% are outliers but also proximate to each other.
     * This is common when IFC files are modeled in different coordinate systems, leading to disparate global positions for files intended to be co-located.
     * There have been cases where IFC files, that should been co-located, are actually
     * located in widely different places on the globe.
     * Whenever {@link add} is called (before {@link clear}) this property is updated.
     */
    get regionBoundingInfo(): BoundingInfo;
    /** @inheritDoc */
    addOrGetIfcProductCache<T extends BimIfcObject = BimIfcObject>(key: string, predicate: BimIfcObjectForEachPredicate): DeepImmutable<Set<T>>;
    /** @inheritDoc */
    deleteIfcProductCache(key: string): boolean;
    /**
     * Loads the property sets for currently loaded IFC files {@link add}.
     * If property sets are already loaded then this method does nothing.
     * @returns A promise that resolves when all property sets have been loaded.
     */
    loadPropertySets(): Promise<void>;
    /**
     * Experimental. Do not use directly. This method will be removed.
     *
     * Opt-in to geometric features by using the @twinfinity/experimental package
     *
     * @internal
     * @hidden
     */
    protected _experimentalLoadGeometricFeatures(): Promise<void>;
    /**
     * Iterate all IFC objects with a callback. Its also possible to call {@link products} to get an iterator.
     * @param action Visitor callback. Called for every IFC object.
     */
    foreach(action: BimIfcObjectForEachAction): void;
    /**
     * Gets a iterator for all Ifc products currently loaded.
     */
    products(): IterableIterator<BimIfcObject>;
    /** @deprecated No longer does anything */
    applyColor(): void;
    /**
     * @deprecated - No longer does anything.
     */
    applyAndResetTrackedVisualChanges(): ReadonlySet<BimIfcObject> | undefined;
    /**
     * Calculate the bounding info for the currently loaded IFC files based on the most populated regions of each IFC file, excluding outliers and anomalous regions.
     *
     * @remarks
     * The bounding info is derived from the regions with the highest IFC product count in each IFC file. Regions distant from the majority are excluded.
     * The `regionBoundingInfo` is critical for camera positioning to ensure the entire `regionBoundingInfo` is within the camera's frustum.
     * Overly large `regionBoundingInfo` can result in the camera being too distant, causing visibility issues.
     * This can occur if anomalies are undetectable, e.g., when 50% of regions are proximate while the remaining 50% are outliers but also proximate to each other.
     * This is common when IFC files are modeled in different coordinate systems, leading to disparate global positions for files intended to be co-located.
     * There have been cases where IFC files, that should been co-located, are actually
     * located in widely different places on the globe.
     * @param onlyMostPopulatedRegions - Indicates whether to include only the most populated regions.
     * @param useWorldSpace - Indicates whether to use world space coordinates. Default is `true`
     * @returns The bounding information for the regions.
     */
    getRegionBoundingInfo(onlyMostPopulatedRegions: boolean, useWorldSpace?: boolean): BoundingInfo;
    /**
     * Adds the specified IFC files or twins to the loader.
     * @remarks
     * When files are added, the loader will load the IFC files and create {@link IBimIfcLoaderElement} instances for each file.
     * See {@link loaderElements} for the created instances.
     * To read the IFC products, present the loaded files, use {@link foreach} or {@link products}.
     *
     * Twin inputs ({@link TwinInput}) are resolved into {@link IfcWithOptions} via the configured {@link TwinInputResolver}.
     *
     * @param inputs - An array of {@link IfcAddInput} (either {@link IfcWithOptions} or {@link TwinInput}).
     * @returns A promise that resolves to an array of {@link IBimIfcLoaderElement} or failure instances.
     * Use {@link isFailure} to check if a returned instance is a failure or not. Its not required to check for failures but
     * it can be useful to know why a file failed to load.
     */
    add(inputs: IfcAddInput | IfcAddInput[]): Promise<(IBimIfcLoaderElement | BimIfcLoaderElementCreateFailure | T8BimIfcLoaderElementCreateFailure)[]>;
    /**
     * Calculates the `min` and `max` coordinate of the axis-aligned bounding box (AABB)
     * encompassing a collection of {@link BimIfcObject}'s.
     * The AABB is defined by the minimum and maximum coordinates in each axis.
     * The result is written to the provided `min` and `max` vectors.
     *
     * @param min - The minimum coordinates of the AABB will be stored in this vector.
     * @param max - The maximum coordinates of the AABB will be stored in this vector.
     * @param ifcProducts - The collection of {@link BimIfcObject} to calculate the AABB for.
     * @param predicate - The predicate function to filter the BimIfcObject. Defaults to {@link DefaultBimIfcObjectForEachPredicate}.
     */
    aabb(min: Vector3, max: Vector3, ifcProducts: BimIfcObject[], predicate?: typeof DefaultBimIfcObjectForEachPredicate): void;
    /**
     * Creates an {@link IfcGeometryBuilder} containing the {@link BimIfcObject} instances matched by the provided predicate.
     * If no predicate is provided, all objects will be included.
     * @remarks
     * The {@link IfcGeometryBuilder} can be used to create {@link Geometry3d} instances for the matched objects. In order to visualize them
     * use {@link TwinfinityViewer.addOrReplaceMesh}.
     *
     * @param options - Optional predicate function to filter the objects.
     * @returns A promise that resolves to an instance of {@link IfcGeometryBuilder}.
     */
    geometryBuilder(options?: ((ifcProduct: BimIfcObject) => unknown) | GeometryBuilderOptions): Promise<IfcGeometryBuilder>;
    /**
     * Clears the state of the {@link BimIfcLoader} instance.
     * If {@link geometryBuilder} has been called, and if it has been used to create {@link Geometry3d} instances
     * that have been added to {@link TwinfinityViewer} then those instances are NOT removed from the viewer.
     * Call {@link BimCoreApi.clear} to remove all geometry from the viewer as well.
     */
    clear(): void;
    private trackAddOfSameIfcFile;
}
export interface BimIfcGeometricFeatureLoader {
    loadGeometricFeatures(): Promise<void>;
}
//# sourceMappingURL=bim-ifc-loader.d.ts.map