/** @packageDocumentation
 * @module UnifiedSelection
 */
import { Id64Arg, IDisposable } from "@itwin/core-bentley";
import { IModelConnection } from "@itwin/core-frontend";
import { Keys, KeySet, SelectionScope, SelectionScopeProps } from "@itwin/presentation-common";
import { SelectionStorage } from "@itwin/unified-selection";
import { HiliteSet } from "./HiliteSetProvider";
import { ISelectionProvider } from "./ISelectionProvider";
import { SelectionChangeEvent } from "./SelectionChangeEvent";
import { SelectionScopesManager } from "./SelectionScopesManager";
/**
 * Properties for creating [[SelectionManager]].
 * @public
 */
export interface SelectionManagerProps {
    /** A manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */
    scopes: SelectionScopesManager;
    /**
     * Custom unified selection storage to be used by [[SelectionManager]]. If not provided [[SelectionManager]] creates
     * and maintains storage.
     */
    selectionStorage?: SelectionStorage;
}
/**
 * The selection manager which stores the overall selection.
 * @public
 */
export declare class SelectionManager implements ISelectionProvider {
    private _selectionStorage;
    private _imodelToolSelectionSyncHandlers;
    private _hiliteSetProviders;
    private _ownsStorage;
    private _knownIModels;
    private _currentSelection;
    private _selectionChanges;
    private _selectionEventsSubscription;
    private _listeners;
    /** An event which gets broadcasted on selection changes */
    readonly selectionChange: SelectionChangeEvent;
    /** Manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */
    readonly scopes: SelectionScopesManager;
    /**
     * Creates an instance of SelectionManager.
     */
    constructor(props: SelectionManagerProps);
    dispose(): void;
    private onConnectionClose;
    /** @internal */
    getToolSelectionSyncHandler(imodel: IModelConnection): ToolSelectionSyncHandler | undefined;
    /**
     * Request the manager to sync with imodel's tool selection (see `IModelConnection.selectionSet`).
     */
    setSyncWithIModelToolSelection(imodel: IModelConnection, sync?: boolean): void;
    /**
     * Temporarily suspends tool selection synchronization until the returned `IDisposable`
     * is disposed.
     */
    suspendIModelToolSelectionSync(imodel: IModelConnection): IDisposable;
    /** Get the selection levels currently stored in this manager for the specified imodel */
    getSelectionLevels(imodel: IModelConnection): number[];
    /**
     * Get the selection currently stored in this manager
     *
     * @note Calling immediately after `add*`|`replace*`|`remove*`|`clear*` method call does not guarantee
     * that returned `KeySet` will include latest changes. Listen for `selectionChange` event to get the
     * latest selection after changes.
     */
    getSelection(imodel: IModelConnection, level?: number): Readonly<KeySet>;
    private handleEvent;
    /**
     * Add keys to the selection
     * @param source Name of the selection source
     * @param imodel iModel associated with the selection
     * @param keys Keys to add
     * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))
     * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control
     */
    addToSelection(source: string, imodel: IModelConnection, keys: Keys, level?: number, rulesetId?: string): void;
    /**
     * Remove keys from current selection
     * @param source Name of the selection source
     * @param imodel iModel associated with the selection
     * @param keys Keys to remove
     * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))
     * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control
     */
    removeFromSelection(source: string, imodel: IModelConnection, keys: Keys, level?: number, rulesetId?: string): void;
    /**
     * Replace current selection
     * @param source Name of the selection source
     * @param imodel iModel associated with the selection
     * @param keys Keys to add
     * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))
     * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control
     */
    replaceSelection(source: string, imodel: IModelConnection, keys: Keys, level?: number, rulesetId?: string): void;
    /**
     * Clear current selection
     * @param source Name of the selection source
     * @param imodel iModel associated with the selection
     * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))
     * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control
     */
    clearSelection(source: string, imodel: IModelConnection, level?: number, rulesetId?: string): void;
    /**
     * Add keys to selection after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.
     * @param source Name of the selection source
     * @param imodel iModel associated with the selection
     * @param ids Element IDs to add
     * @param scope Selection scope to apply
     * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))
     * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control
     */
    addToSelectionWithScope(source: string, imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string, level?: number, rulesetId?: string): Promise<void>;
    /**
     * Remove keys from current selection after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.
     * @param source Name of the selection source
     * @param imodel iModel associated with the selection
     * @param ids Element IDs to remove
     * @param scope Selection scope to apply
     * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))
     * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control
     */
    removeFromSelectionWithScope(source: string, imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string, level?: number, rulesetId?: string): Promise<void>;
    /**
     * Replace current selection with keys after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.
     * @param source Name of the selection source
     * @param imodel iModel associated with the selection
     * @param ids Element IDs to replace with
     * @param scope Selection scope to apply
     * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))
     * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control
     */
    replaceSelectionWithScope(source: string, imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string, level?: number, rulesetId?: string): Promise<void>;
    /**
     * Get the current hilite set for the specified imodel
     * @public
     */
    getHiliteSet(imodel: IModelConnection): Promise<HiliteSet>;
    /**
     * Get the current hilite set iterator for the specified imodel.
     * @public
     */
    getHiliteSetIterator(imodel: IModelConnection): AsyncIterableIterator<HiliteSet>;
    private getHiliteSetProvider;
    private streamSelectionEvents;
}
/** @internal */
export declare class ToolSelectionSyncHandler implements IDisposable {
    private _selectionSourceName;
    private _logicalSelection;
    private _imodel;
    private _imodelToolSelectionListenerDisposeFunc;
    private _asyncsTracker;
    isSuspended?: boolean;
    constructor(imodel: IModelConnection, logicalSelection: SelectionManager);
    dispose(): void;
    /** note: used only it tests */
    get pendingAsyncs(): Set<string>;
    private onToolSelectionChanged;
}
//# sourceMappingURL=SelectionManager.d.ts.map