import { ServiceRef } from '../services/system/types';
import { BackendFeature } from '../types';
/**
 * TODO
 *
 * @public
 */
export type ExtensionPoint<T> = {
    id: string;
    /**
     * Utility for getting the type of the extension point, using `typeof extensionPoint.T`.
     * Attempting to actually read this value will result in an exception.
     */
    T: T;
    toString(): string;
    $$type: '@backstage/ExtensionPoint';
};
/** @ignore */
type DepsToInstances<TDeps extends {
    [key in string]: ServiceRef<unknown> | ExtensionPoint<unknown>;
}> = {
    [key in keyof TDeps]: TDeps[key] extends ServiceRef<unknown, any, 'multiton'> ? Array<TDeps[key]['T']> : TDeps[key]['T'];
};
/**
 * The callbacks passed to the `register` method of a backend plugin.
 *
 * @public
 */
export interface BackendPluginRegistrationPoints {
    registerExtensionPoint<TExtensionPoint>(ref: ExtensionPoint<TExtensionPoint>, impl: TExtensionPoint): void;
    registerInit<TDeps extends {
        [name in string]: ServiceRef<unknown>;
    }>(options: {
        deps: TDeps;
        init(deps: DepsToInstances<TDeps>): Promise<void>;
    }): void;
}
/**
 * The callbacks passed to the `register` method of a backend module.
 *
 * @public
 */
export interface BackendModuleRegistrationPoints {
    registerExtensionPoint<TExtensionPoint>(ref: ExtensionPoint<TExtensionPoint>, impl: TExtensionPoint): void;
    registerInit<TDeps extends {
        [name in string]: ServiceRef<unknown> | ExtensionPoint<unknown>;
    }>(options: {
        deps: TDeps;
        init(deps: DepsToInstances<TDeps>): Promise<void>;
    }): void;
}
/**
 * @public
 */
export interface InternalBackendFeatureLoader extends BackendFeature {
    version: 'v1';
    featureType: 'loader';
    description: string;
    deps: Record<string, ServiceRef<unknown>>;
    loader(deps: Record<string, unknown>): Promise<BackendFeature[]>;
}
export {};
