import { Events } from '../coreUtils/events';
import { LinkModel, ElementIri, ElementTypeIri, LinkTypeIri, PropertyTypeIri } from '../data/model';
import { DataProvider } from '../data/provider';
import { Graph } from '../diagram/graph';
import { ElementType, LinkType, PropertyType } from './dataElements';
import { DataGraph } from './dataGraph';
export interface DataFetcherEvents {
    changeOperations: ChangeOperationsEvent;
}
/**
 * Event data for change current fetch operations event.
 */
export interface ChangeOperationsEvent {
    /**
     * Previous operations before the change.
     */
    readonly previous: ReadonlyArray<FetchOperation>;
    /**
     * If set, specifies the operation that failed and the fail reason (error).
     */
    readonly fail?: FetchOperationFail;
}
/**
 * Describes the failed operation with its fail reason (error).
 *
 * @see {@link ChangeOperationsEvent}
 */
export interface FetchOperationFail {
    /**
     * Operation that failed.
     */
    readonly operation: FetchOperation;
    /**
     * The reason why operation failed (the thrown exception).
     */
    readonly error: unknown;
}
/**
 * Describes a operation to fetch graph data from a data provider.
 *
 * @see {@link DataProvider}
 */
export type FetchOperation = FetchOperationElement | FetchOperationLink | FetchOperationElementType | FetchOperationLinkType | FetchOperationPropertyType;
/**
 * A possible `type` value for an fetch operation with a set of targets.
 *
 * @see {@link FetchOperation}
 */
export type FetchOperationTargetType = Exclude<FetchOperation['type'], 'link'>;
/**
 * A type which maps fetch operation `type` to a target type for such operation.
 *
 * @see {@link FetchOperation}
 */
export interface FetchOperationTypeToTarget {
    'element': ElementIri;
    'elementType': ElementTypeIri;
    'linkType': LinkTypeIri;
    'propertyType': PropertyTypeIri;
}
/**
 * Fetch operation for an element (graph node) data.
 */
export interface FetchOperationElement {
    /**
     * Fetch operation type.
     */
    readonly type: 'element';
    /**
     * Fetch operation targets.
     */
    readonly targets: ReadonlySet<ElementIri>;
}
/**
 * Fetch operation for links (graph edges) between elements.
 */
export interface FetchOperationLink {
    /**
     * Fetch operation type.
     */
    readonly type: 'link';
}
/**
 * Fetch operation for an element type data.
 */
export interface FetchOperationElementType {
    /**
     * Fetch operation type.
     */
    readonly type: 'elementType';
    /**
     * Fetch operation targets.
     */
    readonly targets: ReadonlySet<ElementTypeIri>;
}
/**
 * Fetch operation for a link type data.
 */
export interface FetchOperationLinkType {
    /**
     * Fetch operation type.
     */
    readonly type: 'linkType';
    /**
     * Fetch operation targets.
     */
    readonly targets: ReadonlySet<LinkTypeIri>;
}
/**
 * Fetch operation for a property type data.
 */
export interface FetchOperationPropertyType {
    /**
     * Fetch operation type.
     */
    readonly type: 'propertyType';
    /**
     * Fetch operation targets.
     */
    readonly targets: ReadonlySet<PropertyTypeIri>;
}
export declare class DataFetcher {
    private graph;
    private dataGraph;
    private dataProvider;
    private readonly source;
    readonly events: Events<DataFetcherEvents>;
    private readonly cancellation;
    private _operations;
    private _failReasons;
    private elementTypeQueue;
    private linkTypeQueue;
    private propertyTypeQueue;
    constructor(graph: Graph, dataGraph: DataGraph, dataProvider: DataProvider);
    get signal(): AbortSignal;
    dispose(): void;
    get operations(): ReadonlyArray<FetchOperation>;
    getFailReason<T extends FetchOperationTargetType>(type: T, target: FetchOperationTypeToTarget[T]): unknown;
    private addOperation;
    private onOperationComplete;
    private ensureFailReasons;
    fetchElementData(elementIris: ReadonlyArray<ElementIri>): Promise<void>;
    private onElementInfoLoaded;
    fetchLinks(primaryIris: ReadonlyArray<ElementIri>, secondaryIris: ReadonlyArray<ElementIri>, linkTypeIris?: ReadonlyArray<LinkTypeIri>): Promise<LinkModel[]>;
    fetchElementType(model: ElementType): void;
    private onElementTypesLoaded;
    fetchLinkType(linkType: LinkType): void;
    private onLinkTypesLoaded;
    fetchPropertyType(propertyType: PropertyType): void;
    private onPropertyTypesLoaded;
}
//# sourceMappingURL=dataFetcher.d.ts.map