/** @packageDocumentation
 * @module Core
 */
import { BeEvent } from "@itwin/core-bentley";
import { IModelConnection } from "@itwin/core-frontend";
import { UnitSystemKey } from "@itwin/core-quantity";
import { SchemaContext } from "@itwin/ecschema-metadata";
import { ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, FormatsMap, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, Item, KeySet, LabelDefinition, Node, NodeKey, NodePathElement, Paged, PagedResponse, RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions } from "@itwin/presentation-common";
import { RpcRequestsHandler } from "@itwin/presentation-common/internal";
import { _presentation_manager_ipcRequestsHandler, _presentation_manager_rpcRequestsHandler } from "./InternalSymbols.js";
import { IpcRequestsHandler } from "./IpcRequestsHandler.js";
import { RulesetManager } from "./RulesetManager.js";
import { RulesetVariablesManager } from "./RulesetVariablesManager.js";
/**
 * Data structure that describes IModel hierarchy change event arguments.
 * @public
 * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
 * package for creating hierarchies.
 */
export interface IModelHierarchyChangeEventArgs {
    /** Id of ruleset that was used to create hierarchy. */
    rulesetId: string;
    /** Hierarchy changes info. */
    updateInfo: HierarchyUpdateInfo;
    /** Key of iModel that was used to create hierarchy. It matches [[IModelConnection.key]] property. */
    imodelKey: string;
}
/**
 * Data structure that describes iModel content change event arguments.
 * @public
 */
export interface IModelContentChangeEventArgs {
    /** Id of ruleset that was used to create content. */
    rulesetId: string;
    /** Content changes info. */
    updateInfo: ContentUpdateInfo;
    /** Key of iModel that was used to create content. It matches [[IModelConnection.key]] property. */
    imodelKey: string;
}
/**
 * Options for requests that can return multiple pages of items concurrently.
 * @public
 */
export type MultipleValuesRequestOptions = Paged<{
    /**
     * Max number of requests that should be made to the backend to fulfill the whole request.
     * `undefined` means no limit, so in that case all requests are sent at once.
     */
    maxParallelRequests?: number;
    /**
     * Size of a single batch when fetching data through multiple requests. If not set,
     * the fall back is requested page size. If the page size is not set, the backend
     * decides how many items to return.
     */
    batchSize?: number;
}>;
/**
 * Options for requests that retrieve nodes.
 * @public
 * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
 * package for creating hierarchies.
 */
export type GetNodesRequestOptions = HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute;
/**
 * Options for requests that retrieve content.
 * @public
 */
export type GetContentRequestOptions = ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute;
/**
 * Options for requests that retrieve distinct values.
 * @public
 */
export type GetDistinctValuesRequestOptions = DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute;
/**
 * Properties used to configure [[PresentationManager]]
 * @public
 */
export interface PresentationManagerProps {
    /**
     * Sets the active locale to use when localizing presentation-related
     * strings. It can later be changed through [[PresentationManager]].
     */
    activeLocale?: string;
    /**
     * Sets the active unit system to use for formatting property values with
     * units. The  value can later be changed through [[PresentationManager.activeUnitSystem]] setter or
     * overriden for each request through request parameters. If not set, `IModelApp.quantityFormatter.activeUnitSystem`
     * is used by default.
     *
     * @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [IModelApp.quantityFormatter]($core-frontend) to set the active unit system.
     */
    activeUnitSystem?: UnitSystemKey;
    /**
     * ID used to identify client that requests data. Generally, clients should
     * store this ID in their local storage so the ID can be reused across
     * sessions - this allows reusing some caches.
     *
     * Defaults to a unique GUID as a client id.
     */
    clientId?: string;
    /**
     * Timeout (in milliseconds) for how long we're going to wait for RPC request to be fulfilled before throwing
     * a timeout error.
     *
     * Defaults to 10 minutes.
     */
    requestTimeout?: number;
    /**
     * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelConnection]($core-frontend).
     * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.
     *
     * @deprecated in 5.1 - will not be removed until after 2026-08-08. By default [IModelConnection.schemaContext]($core-frontend) is now used instead.
     */
    schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;
    /**
     * A map of default unit formats to use for formatting properties that don't have a presentation format
     * in requested unit system.
     *
     * @note Only has effect when frontend value formatting is enabled by supplying the `schemaContextProvider` prop.
     *
     * @deprecated in 5.1 - will not be removed until after 2026-08-08. All formats' logic is now handled by [IModelApp.formatsProvider]($core-frontend). Until the prop is removed, when
     * supplied, this map will be used as a fallback if IModelApp's formats provider doesn't return anything for requested format.
     */
    defaultFormats?: FormatsMap;
}
/**
 * Frontend Presentation manager which basically just forwards all calls to
 * the backend implementation.
 *
 * @public
 */
export declare class PresentationManager implements Disposable {
    private _requestsHandler;
    private _rulesets;
    private _localizationHelper;
    private _explicitActiveUnitSystem;
    private _rulesetVars;
    private _clearEventListener?;
    private _schemaContextProvider;
    private _defaultFormats?;
    private _ipcRequestsHandler?;
    /**
     * An event raised when hierarchies created using specific ruleset change.
     *
     * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
     * package for creating hierarchies.
     */
    onIModelHierarchyChanged: BeEvent<(args: IModelHierarchyChangeEventArgs) => void>;
    /**
     * An event raised when content created using specific ruleset changes
     */
    onIModelContentChanged: BeEvent<(args: IModelContentChangeEventArgs) => void>;
    /**
     * Get / set active unit system used to format property values with units.
     *
     * @deprecated in 4.0 - will not be removed until after 2026-06-13. `IModelApp.quantityFormatter` should be used to get/set the active unit system. At the moment
     * [[PresentationManager]] allows overriding it, but returns `IModelApp.quantityFormatter.activeUnitSystem` if override
     * is not set.
     */
    get activeUnitSystem(): UnitSystemKey;
    set activeUnitSystem(value: UnitSystemKey | undefined);
    private constructor();
    /** Get / set active locale used for localizing presentation data */
    get activeLocale(): string | undefined;
    set activeLocale(locale: string | undefined);
    [Symbol.dispose](): void;
    /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
    dispose(): void;
    private onUpdate;
    /** @note This is only called in native apps after changes in iModels */
    private handleUpdateAsync;
    /**
     * Create a new PresentationManager instance
     * @param props Optional properties used to configure the manager
     */
    static create(props?: PresentationManagerProps): PresentationManager;
    /** @internal */
    get [_presentation_manager_rpcRequestsHandler](): RpcRequestsHandler;
    /** @internal */
    get [_presentation_manager_ipcRequestsHandler](): IpcRequestsHandler | undefined;
    /**
     * Get rulesets manager
     */
    rulesets(): RulesetManager;
    /**
     * Get ruleset variables manager for specific ruleset
     * @param rulesetId Id of the ruleset to get the vars manager for
     */
    vars(rulesetId: string): RulesetVariablesManager;
    private toRpcTokenOptions;
    private addRulesetAndVariablesToOptions;
    /**
     * Returns an iterator that polls nodes asynchronously.
     * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
     * package for creating hierarchies.
     */
    getNodesIterator(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<{
        total: number;
        items: AsyncIterableIterator<Node>;
    }>;
    /**
     * Retrieves nodes.
     * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getNodesIterator]] instead.
     */
    getNodes(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<Node[]>;
    /**
     * Retrieves nodes count.
     * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
     * package for creating hierarchies.
     */
    getNodesCount(requestOptions: GetNodesRequestOptions): Promise<number>;
    /**
     * Retrieves total nodes count and a single page of nodes.
     * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getNodesIterator]] instead.
     */
    getNodesAndCount(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<{
        count: number;
        nodes: Node[];
    }>;
    /**
     * Retrieves hierarchy level descriptor.
     * @public
     * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
     * package for creating hierarchies.
     */
    getNodesDescriptor(requestOptions: HierarchyLevelDescriptorRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute): Promise<Descriptor | undefined>;
    /**
     * Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged.
     * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
     * package for creating hierarchies.
     */
    getNodePaths(requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]>;
    /**
     * Retrieves paths from root nodes to nodes containing filter text in their label.
     * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
     * package for creating hierarchies.
     */
    getFilteredNodePaths(requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]>;
    /**
     * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,
     * its related instances for loading related and navigation properties.
     * @public
     */
    getContentSources(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]>;
    /** Retrieves the content descriptor which describes the content and can be used to customize it. */
    getContentDescriptor(requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<Descriptor | undefined>;
    /** Retrieves overall content set size. */
    getContentSetSize(requestOptions: GetContentRequestOptions): Promise<number>;
    private getContentIteratorInternal;
    /** Retrieves a content descriptor, item count and async generator for the items themselves. */
    getContentIterator(requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions): Promise<{
        descriptor: Descriptor;
        total: number;
        items: AsyncIterableIterator<Item>;
    } | undefined>;
    /**
     * Retrieves content which consists of a content descriptor and a page of records.
     * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getContentIterator]] instead.
     */
    getContent(requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions): Promise<Content | undefined>;
    /**
     * Retrieves content set size and content which consists of a content descriptor and a page of records.
     * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getContentIterator]] instead.
     */
    getContentAndSize(requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions): Promise<{
        content: Content;
        size: number;
    } | undefined>;
    /** Returns an iterator that asynchronously polls distinct values of specific field from the content. */
    getDistinctValuesIterator(requestOptions: GetDistinctValuesRequestOptions & MultipleValuesRequestOptions): Promise<{
        total: number;
        items: AsyncIterableIterator<DisplayValueGroup>;
    }>;
    /**
     * Retrieves distinct values of specific field from the content.
     * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getDistinctValuesIterator]] instead.
     */
    getPagedDistinctValues(requestOptions: GetDistinctValuesRequestOptions & MultipleValuesRequestOptions): Promise<PagedResponse<DisplayValueGroup>>;
    /**
     * Retrieves property data in a simplified format for a single element specified by ID.
     * @public
     */
    getElementProperties<TParsedContent = ElementProperties>(requestOptions: SingleElementPropertiesRequestOptions<IModelConnection, TParsedContent> & ClientDiagnosticsAttribute): Promise<TParsedContent | undefined>;
    /**
     * Retrieves content item instance keys.
     * @public
     */
    getContentInstanceKeys(requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions): Promise<{
        total: number;
        items: () => AsyncGenerator<InstanceKey>;
    }>;
    /** Retrieves display label definition of specific item. */
    getDisplayLabelDefinition(requestOptions: DisplayLabelRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute): Promise<LabelDefinition>;
    /** Retrieves display label definition of specific items. */
    getDisplayLabelDefinitionsIterator(requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions): Promise<{
        total: number;
        items: AsyncIterableIterator<LabelDefinition>;
    }>;
    /**
     * Retrieves display label definition of specific items.
     * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getDisplayLabelDefinitionsIterator]] instead.
     */
    getDisplayLabelDefinitions(requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions): Promise<LabelDefinition[]>;
}
//# sourceMappingURL=PresentationManager.d.ts.map