import type { PluginContextOptions } from './plugin-context';
import { type PluginExtend } from './plugin-extend';
import { PluginContext } from './plugin-context';
import { PluginRuntime } from './plugin-runtime';
export interface Plugin {
    name: string;
    deps?: string[];
    eventPrefix?: string;
    init(ctx: PluginContext): Promise<void> | void;
    destroy?(ctx: PluginContext): Promise<void> | void;
    extend?(ctx: PluginExtend): void;
}
export interface PluginMeta {
    /**
     * define dependencies which the plugin depends on
     */
    dependencies?: string[];
    /**
     * use 'common' as event prefix when eventPrefix is not set.
     */
    eventPrefix?: string;
}
export type PluginCreator<O = any> = (options?: O) => Plugin;
export interface PluginRegisterOptions {
    /**
     * Will enable plugin registered with auto-initialization immediately
     * other than plugin-manager init all plugins at certain time.
     * It is helpful when plugin register is later than plugin-manager initialization.
     */
    autoInit?: boolean;
    /**
     * allow overriding existing plugin with same name when override === true
     */
    override?: boolean;
}
/**
 * Assemble APIs for plugins to create context
 */
export interface PluginContextApiAssembler {
    assembleApis(context: PluginContext, pluginName: string, meta: PluginMeta): void;
}
export declare class PluginManager {
    private plugins;
    pluginsMap: Map<string, PluginRuntime>;
    pluginContextMap: Map<string, PluginContext>;
    private contextApiAssembler;
    constructor(contextApiAssembler?: PluginContextApiAssembler);
    setContextApiAssembler(contextApiAssembler: PluginContextApiAssembler): void;
    getPluginContext: (options: PluginContextOptions) => PluginContext;
    /**
     * register a plugin
     * @param pluginConfigCreator - a creator function which returns the plugin config
     * @param options - the plugin options
     * @param registerOptions - the plugin register options
     */
    register(pluginModel: Plugin, registerOptions?: PluginRegisterOptions): Promise<void>;
    /**
     * batch register plugins
     */
    registerPlugins(plugins: Plugin[], registerOptions?: PluginRegisterOptions): Promise<void>;
    get(pluginName: string): PluginRuntime | undefined;
    getAll(): PluginRuntime[];
    has(pluginName: string): boolean;
    delete(pluginName: string): Promise<boolean>;
    init(): Promise<void>;
    /**
     * destroy all plugins
     */
    destroy(): Promise<void>;
    extend(): Promise<void>;
    get size(): number;
    setDisabled(pluginName: string, flag?: boolean): void;
    /**
     * reset plugin manager
     */
    dispose(): Promise<void>;
}
export declare const isRegisterOptions: (opts: any) => opts is PluginRegisterOptions;
