/**
 * File Watcher for Awake Lambda Development Hot Reload
 *
 * Provides cross-platform file watching with debouncing for hot reload support.
 * Uses chokidar for reliable file system watching across macOS, Linux, and Windows.
 *
 * @module bin/commands/dev/file-watcher
 *
 * @see Requirements 5.1, 7.3, 7.4
 */
import { EventEmitter } from 'events';
/**
 * Default debounce delay in milliseconds.
 */
export declare const DEFAULT_DEBOUNCE_MS = 100;
/**
 * Default ignore patterns for file watching.
 */
export declare const DEFAULT_IGNORE_PATTERNS: string[];
/**
 * File change event type.
 */
export type FileChangeType = 'add' | 'change' | 'unlink';
/**
 * File change event.
 */
export interface FileChangeEvent {
    /** Type of change */
    readonly type: FileChangeType;
    /** Absolute path to the changed file */
    readonly path: string;
    /** Relative path from watch root */
    readonly relativePath: string;
    /** Timestamp of the change */
    readonly timestamp: number;
}
/**
 * File watcher configuration.
 */
export interface FileWatcherConfig {
    /** Paths to watch (directories or files) */
    readonly watchPaths: string[];
    /** Patterns to ignore (glob patterns) */
    readonly ignorePatterns?: string[];
    /** Debounce delay in milliseconds (default: 100) */
    readonly debounceMs?: number;
    /** Use polling instead of native events (more reliable on some systems) */
    readonly usePolling?: boolean;
    /** Polling interval in milliseconds (only used if usePolling is true) */
    readonly pollingInterval?: number;
    /** Base path for relative path calculation */
    readonly basePath?: string;
}
/**
 * Events emitted by FileWatcher.
 */
export interface FileWatcherEvents {
    'change': (event: FileChangeEvent) => void;
    'batch': (events: FileChangeEvent[]) => void;
    'ready': () => void;
    'error': (error: Error) => void;
}
/**
 * File watcher state.
 */
export type FileWatcherState = 'idle' | 'starting' | 'watching' | 'stopped';
/**
 * Error class for file watcher failures.
 */
export declare class FileWatcherError extends Error {
    readonly cause?: Error | undefined;
    constructor(message: string, cause?: Error | undefined);
}
/**
 * File Watcher for Awake Lambda Development.
 *
 * Provides cross-platform file watching with debouncing for hot reload support.
 * Emits 'change' events for individual file changes and 'batch' events for
 * debounced batches of changes.
 *
 * @see Requirements 5.1, 7.3
 *
 * @example
 * ```typescript
 * const watcher = new FileWatcher({
 *   watchPaths: ['./src'],
 *   ignorePatterns: ['node_modules', '*.test.ts'],
 *   debounceMs: 100,
 * });
 *
 * watcher.on('batch', (events) => {
 *   console.log('Files changed:', events.map(e => e.path));
 *   // Trigger hot reload
 * });
 *
 * await watcher.start();
 *
 * // Later...
 * await watcher.stop();
 * ```
 */
export declare class FileWatcher extends EventEmitter {
    /** Chokidar watcher instance */
    private watcher;
    /** Current state */
    private state;
    /** Configuration */
    private readonly config;
    /** Pending changes for debouncing */
    private pendingChanges;
    /** Debounce timer */
    private debounceTimer;
    /** Ready promise resolver */
    private readyResolver;
    /**
     * Create a new FileWatcher.
     *
     * @param config - File watcher configuration
     */
    constructor(config: FileWatcherConfig);
    /**
     * Get current watcher state.
     */
    getState(): FileWatcherState;
    /**
     * Check if watcher is actively watching.
     */
    isWatching(): boolean;
    /**
     * Get the configured watch paths.
     */
    getWatchPaths(): string[];
    /**
     * Get the configured ignore patterns.
     */
    getIgnorePatterns(): string[];
    /**
     * Get the debounce delay in milliseconds.
     */
    getDebounceMs(): number;
    /**
     * Start watching for file changes.
     *
     * @returns Promise that resolves when watcher is ready
     * @throws FileWatcherError if watcher fails to start
     *
     * @see Requirements 5.1
     */
    start(): Promise<void>;
    /**
     * Stop watching for file changes.
     *
     * @returns Promise that resolves when watcher is stopped
     */
    stop(): Promise<void>;
    /**
     * Handle a file change event.
     *
     * @param type - Type of change
     * @param filePath - Absolute path to the changed file
     * @private
     */
    private handleFileChange;
    /**
     * Flush pending changes and emit batch event.
     *
     * @private
     */
    private flushPendingChanges;
    /**
     * Add a path to watch.
     *
     * @param watchPath - Path to add (directory or file)
     */
    addPath(watchPath: string): void;
    /**
     * Remove a path from watching.
     *
     * @param watchPath - Path to remove
     */
    removePath(watchPath: string): void;
    /**
     * Get the list of watched paths.
     *
     * @returns Object with watched directories and files
     */
    getWatched(): Record<string, string[]>;
    /**
     * Get diagnostic information about the watcher.
     *
     * @returns Diagnostic information
     */
    getDiagnostics(): {
        state: FileWatcherState;
        watchPaths: string[];
        ignorePatterns: string[];
        debounceMs: number;
        usePolling: boolean;
        pendingChangesCount: number;
        watchedPaths: Record<string, string[]>;
    };
}
/**
 * Normalize a file path for cross-platform compatibility.
 *
 * Converts backslashes to forward slashes and handles Windows drive letters.
 *
 * @param inputPath - Path to normalize
 * @returns Normalized path
 *
 * @see Requirements 7.3
 */
export declare function normalizeFilePath(inputPath: string): string;
/**
 * Resolve a handler path relative to a base path.
 *
 * Always uses forward slashes in config, converts at runtime.
 *
 * @param basePath - Base path for resolution
 * @param handlerPath - Handler path (may use forward slashes)
 * @returns Resolved absolute path
 *
 * @see Requirements 7.3
 */
export declare function resolveHandlerPath(basePath: string, handlerPath: string): string;
/**
 * Check if a file path matches any of the ignore patterns.
 *
 * @param filePath - File path to check
 * @param ignorePatterns - Glob patterns to match against
 * @returns True if the file should be ignored
 */
export declare function shouldIgnoreFile(filePath: string, ignorePatterns: string[]): boolean;
/**
 * Extract the microservice name from a file path.
 *
 * Attempts to determine which microservice a file belongs to based on path.
 *
 * @param filePath - File path to analyze
 * @param microserviceNames - List of known microservice names
 * @returns Microservice name or null if not determinable
 */
export declare function extractMicroserviceName(filePath: string, microserviceNames: string[]): string | null;
