import { ModelHub, ModelHubSubscription } from '@eclipse-emfcloud/model-service';
import { Diagnostic } from '@eclipse-emfcloud/model-validation';
import { ILogger } from '@theia/core';
import { ModelHubProtocol } from '../common';
import { FrontendModelAccessorBus, FrontendModelAccessorBusImpl } from './frontend-model-accessor-bus';
import { FrontendModelHubSubscriber } from './frontend-model-hub-subscriber';
/**
 * Dependency injection key for the Frontend Model Hub provider.
 */
export declare const FrontendModelHubProvider: unique symbol;
export type FrontendModelHubProvider<K = string> = (context: string) => Promise<FrontendModelHub<K>>;
/**
 * Transformation of a synchronous method signature to an
 * asynchronous one returning a promise of the original
 * return type.
 */
type MakeAsync<T> = T extends (...args: unknown[]) => unknown ? ReturnType<T> extends Promise<unknown> ? T : (...args: Parameters<T>) => Promise<ReturnType<T>> : never;
/** Helper type to extract the keys that are of method type. */
type MethodKeysOf<T> = {
    [K in keyof T]: T[K] extends (...args: unknown[]) => unknown ? K : never;
}[keyof T];
/**
 * A {@link ModelHub} projected from the Theia backend in which all
 * of its methods are asynchronous over the RPC channel. This
 * frontend model hub can be used in the front end exactly as the
 * Model Hub would be in the backend, except that it does not
 * provide access to backend-only capabilities such as:
 *
 * - model service contributions (especially adding them)
 * - public model service APIs
 * - the context defining the Model Hub's scope
 * - live validation engagement
 *
 * All other capabilities, such as retrieving models, saving
 * them, checking dirty state, validating, undo/redo, are
 * supported.
 */
export type FrontendModelHub<K = string> = {
    [key in Exclude<MethodKeysOf<ModelHub<K, string>>, 'dispose' | 'addModelServiceContribution' | 'getModelService' | 'liveValidation' | 'getModelAccessorBus'>]: MakeAsync<ModelHub<K, string>[key]>;
} & {
    readonly context: string;
    readonly isDisposed: boolean;
    getModelAccessorBus: () => FrontendModelAccessorBus;
};
export declare const FrontendModelHubContext: unique symbol;
export declare class FrontendModelHubImpl<K = string> implements FrontendModelHub<K> {
    readonly context: string;
    protected readonly delegate: ModelHubProtocol<K>;
    protected readonly subscriber: FrontendModelHubSubscriber<K>;
    protected readonly modelAccessorBus: FrontendModelAccessorBusImpl;
    protected readonly logger: ILogger;
    private disposed;
    protected initialize(): void;
    protected doInitialize(): Promise<void>;
    get isDisposed(): boolean;
    subscribe<M extends object = object>(...modelIds: K[]): Promise<ModelHubSubscription<K, M>>;
    getModelAccessorBus(): FrontendModelAccessorBus;
    getModel<M extends object = object>(modelId: K): Promise<M>;
    validateModels(...modelIds: K[]): Promise<Diagnostic>;
    getValidationState(...modelIds: K[]): Promise<Diagnostic | undefined>;
    save(...commandStackIds: string[]): Promise<boolean>;
    isDirty(commandStackId: string): Promise<boolean>;
    undo(commandStackId: string): Promise<boolean>;
    redo(commandStackId: string): Promise<boolean>;
    flush(commandStackId: string): Promise<boolean>;
}
export {};
//# sourceMappingURL=frontend-model-hub.d.ts.map