/** @packageDocumentation
 * @module Core
 */
import { BeEvent, IDisposable } from "@itwin/core-bentley";
import { IModelConnection } from "@itwin/core-frontend";
import { Field } from "@itwin/presentation-common";
import { IFavoritePropertiesStorage } from "./FavoritePropertiesStorage";
/**
 * Scopes that favorite properties can be stored in.
 * @public
 */
export declare enum FavoritePropertiesScope {
    Global = 0,
    ITwin = 1,
    IModel = 2
}
/**
 * Format:
 * Regular property - [{path from parent class}-]{schema name}:{class name}:{property name}.
 * Nested property - [{path from parent class}-]{content class schema name}:{content class name}.
 * Primitive property - {field name}.
 * @public
 */
export type PropertyFullName = string;
/**
 * Holds the information of favorite properties ordering.
 * @public
 */
export interface FavoritePropertiesOrderInfo {
    parentClassName: string | undefined;
    name: PropertyFullName;
    priority: number;
    orderedTimestamp: Date;
}
/**
 * Properties for initializing [[FavoritePropertiesManager]]
 * @public
 */
export interface FavoritePropertiesManagerProps {
    /**
     * Implementation of a persistence layer for storing favorite properties and their order.
     * @public
     */
    storage: IFavoritePropertiesStorage;
}
/**
 * The favorite property manager which lets to store favorite properties
 * and check if field contains favorite properties.
 *
 * @public
 */
export declare class FavoritePropertiesManager implements IDisposable {
    /**
     * Used in tests to avoid collisions between multiple runs using the same storage
     * @internal
     */
    static FAVORITES_IDENTIFIER_PREFIX: string;
    /** Event raised after favorite properties have changed. */
    onFavoritesChanged: BeEvent<() => void>;
    private _storage;
    private _globalProperties;
    private _iTwinProperties;
    private _imodelProperties;
    private _imodelBaseClassesByClass;
    private _imodelInitializationPromises;
    /** Property order is saved only in iModel scope */
    private _propertiesOrder;
    constructor(props: FavoritePropertiesManagerProps);
    dispose(): void;
    /**
     * Initialize favorite properties for the provided IModelConnection.
     * @deprecated in 4.5. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].
     */
    initializeConnection: (imodel: IModelConnection) => Promise<void>;
    /**
     * Function that removes order information of properties that are no longer
     * favorited and adds missing order information for favorited properties.
     */
    private _adjustPropertyOrderInfos;
    private isInitialized;
    /**
     * Checks if [[FavoritePropertiesManager.initializeConnection]] has been called for a given imodel.
     * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.
     */
    private validateInitialization;
    /**
     * Calls [[FavoritePropertiesManager.initializeConnection]] and caches the promise which should be awaited by calling [[FavoritePropertiesManager.ensureInitialized]].
     * @internal
     */
    startConnectionInitialization(imodel: IModelConnection): void;
    /**
     * Performs the initialization process or finishes the one that was started by [[FavoritePropertiesManager.startConnectionInitialization]].
     * @internal
     */
    ensureInitialized(imodel: IModelConnection): Promise<void>;
    /**
     * Adds favorite properties into a certain scope.
     * @param field Field that contains properties. If field contains multiple properties, all of them will be favorited.
     * @param imodel IModelConnection.
     * @param scope FavoritePropertiesScope to put the favorite properties into.
     */
    add(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void>;
    /**
     * Removes favorite properties from a scope specified and all the more general scopes.
     * @param field Field that contains properties. If field contains multiple properties, all of them will be un-favorited.
     * @param imodel IModelConnection.
     * @param scope FavoritePropertiesScope to remove the favorite properties from. It also removes from more general scopes.
     */
    remove(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void>;
    /**
     * Removes all favorite properties from a certain scope.
     * @param imodel IModelConnection.
     * @param scope FavoritePropertiesScope to remove the favorite properties from.
     */
    clear(imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void>;
    /**
     * Check if field contains at least one favorite property.
     * @param field Field that contains properties.
     * @param imodel IModelConnection.
     * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.
     * @note `initializeConnection` must be called with the `imodel` before calling this function.
     * @deprecated in 4.5. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].
     */
    has(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): boolean;
    /**
     * Check if field contains at least one favorite property.
     * @param field Field that contains properties.
     * @param imodel IModelConnection.
     * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.
     */
    hasAsync(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<boolean>;
    /**
     * Sorts an array of fields with respect to favorite property order.
     * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.
     * @param imodel IModelConnection.
     * @param fields Array of Field's that needs to be sorted.
     * @note `initializeConnection` must be called with the `imodel` before calling this function.
     * @deprecated in 4.5. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].
     */
    sortFields: (imodel: IModelConnection, fields: Field[]) => Field[];
    /**
     * Sorts an array of fields with respect to favorite property order.
     * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.
     * @param imodel IModelConnection.
     * @param fields Array of Field's that needs to be sorted.
     */
    sortFieldsAsync(imodel: IModelConnection, fields: Field[]): Promise<Field[]>;
    private getFieldPriority;
    private _getBaseClassesByClass;
    /** Changes field properties priorities to lower than another fields priority
     * @param imodel IModelConnection.
     * @param field Field that priority is being changed.
     * @param afterField Field that goes before the moved field. If undefined the moving field is changed to the highest priority (to the top).
     * @param visibleFields Array of fields to move the field in.
     */
    changeFieldPriority(imodel: IModelConnection, field: Field, afterField: Field | undefined, visibleFields: Field[]): Promise<void>;
}
/** @internal */
export declare const getFieldInfos: (field: Field) => Set<PropertyFullName>;
/** @internal */
export declare const createFieldOrderInfos: (field: Field) => FavoritePropertiesOrderInfo[];
//# sourceMappingURL=FavoritePropertiesManager.d.ts.map