/**
 * Plugin Service
 *
 * Manages plugin registration and hook execution for the Crewly
 * extensibility system. Plugins (like Crewly Pro) register handlers
 * for specific hook points, and the core system invokes them at the
 * appropriate moments.
 *
 * Singleton pattern matching other Crewly services.
 *
 * @module services/plugin/plugin.service
 */
import type { HookName, HookPayloadMap, CrewlyPlugin } from './plugin.types.js';
/**
 * PluginService manages the plugin lifecycle and hook dispatch.
 *
 * Plugins register via `registerPlugin()` and the core system
 * calls `executeHook()` at defined extension points. Handlers
 * are executed in registration order and errors in one handler
 * do not prevent others from running.
 */
export declare class PluginService {
    private static instance;
    /** Registered plugins indexed by ID */
    private plugins;
    /** Hook handlers grouped by hook name */
    private hooks;
    private constructor();
    /**
     * Get the singleton instance.
     *
     * @returns The singleton instance
     */
    static getInstance(): PluginService;
    /**
     * Clear the singleton instance (for testing).
     */
    static clearInstance(): void;
    /**
     * Register a plugin with the system.
     *
     * Extracts hook handlers from the plugin and adds them to the
     * internal registry. If a plugin with the same ID is already
     * registered, it is replaced.
     *
     * @param plugin - The plugin to register
     */
    registerPlugin(plugin: CrewlyPlugin): void;
    /**
     * Unregister a plugin and remove all its hook handlers.
     *
     * @param pluginId - The plugin ID to remove
     * @returns True if the plugin was found and removed
     */
    unregisterPlugin(pluginId: string): boolean;
    /**
     * Get a registered plugin by ID.
     *
     * @param pluginId - The plugin ID
     * @returns The plugin, or undefined if not found
     */
    getPlugin(pluginId: string): CrewlyPlugin | undefined;
    /**
     * List all registered plugins.
     *
     * @returns Array of registered plugins
     */
    listPlugins(): CrewlyPlugin[];
    /**
     * Get the number of registered plugins.
     *
     * @returns Plugin count
     */
    getPluginCount(): number;
    /**
     * Execute all handlers registered for a hook.
     *
     * Handlers are called in registration order. Errors in one handler
     * are caught and do not prevent subsequent handlers from running.
     * Async handlers are awaited sequentially.
     *
     * @param hookName - The hook to execute
     * @param payload - The payload to pass to each handler
     * @returns Array of errors from failed handlers (empty if all succeeded)
     */
    executeHook<K extends HookName>(hookName: K, payload: HookPayloadMap[K]): Promise<Error[]>;
    /**
     * Get the number of handlers registered for a specific hook.
     *
     * @param hookName - The hook name
     * @returns Number of registered handlers
     */
    getHandlerCount(hookName: HookName): number;
    /**
     * Check if any handlers are registered for a hook.
     *
     * @param hookName - The hook name
     * @returns True if at least one handler is registered
     */
    hasHandlers(hookName: HookName): boolean;
}
//# sourceMappingURL=plugin.service.d.ts.map