import type { BuildOptions } from 'esbuild';
import type { WebSocket } from 'ws';
/**
 * Result of a rebuild operation from esbuild watch mode
 */
export interface RebuildResult {
    /**
     * Whether the rebuild completed without errors
     */
    success: boolean;
    /**
     * Build duration in milliseconds
     */
    duration: number;
    /**
     * Array of error messages (if any)
     */
    errors?: string[];
    /**
     * Array of warning messages (if any)
     */
    warnings?: string[];
    /**
     * Unix timestamp of rebuild completion
     */
    timestamp: number;
}
/**
 * Configuration for BuildWatcher component
 */
export interface BuildWatcherConfig {
    /**
     * esbuild configuration options
     */
    buildConfig: BuildOptions;
    /**
     * Callback invoked when a rebuild completes (success or failure)
     */
    onRebuild: (result: RebuildResult) => void;
}
/**
 * Message sent from server to browser clients via WebSocket
 */
export interface ReloadMessage {
    /**
     * Message type
     * - 'reload': Trigger page reload
     * - 'error': Error notification
     * - 'connected': Connection established confirmation
     */
    type: 'reload' | 'error' | 'connected';
    /**
     * Unix timestamp of message creation
     */
    timestamp: number;
    /**
     * Optional human-readable message
     */
    message?: string;
    /**
     * Optional build duration in milliseconds (for reload messages)
     */
    buildDuration?: number;
}
/**
 * Configuration for ReloadNotifier component
 */
export interface ReloadNotifierConfig {
    /**
     * WebSocket server port (typically HTTP port + 1)
     */
    port: number;
}
/**
 * Internal representation of a connected browser client
 */
export interface WebSocketClient {
    /**
     * Unique client identifier (UUID)
     */
    id: string;
    /**
     * WebSocket connection instance
     */
    socket: WebSocket;
    /**
     * Unix timestamp of connection establishment
     */
    connectedAt: number;
    /**
     * Unix timestamp of last ping (for health checks)
     */
    lastPing: number;
}
/**
 * Development server configuration
 */
export interface DevServerConfig {
    /**
     * HTTP server port
     */
    port: number;
    /**
     * Deployment stage (e.g., 'dev', 'staging', 'production')
     */
    stage: string;
    /**
     * Path to React application entry point
     */
    reactEntry: string;
    /**
     * URL path for main JavaScript bundle (e.g., '/main.js')
     */
    mainJsUrl: string;
    /**
     * Current working directory
     */
    cwd: string;
    /**
     * Enable Hot Module Replacement / live reload
     * @default true
     */
    enableHMR?: boolean;
    /**
     * WebSocket server port for HMR notifications
     * @default port + 1
     */
    hmrPort?: number;
    /**
     * esbuild configuration for watch mode
     * Required if enableHMR is true
     */
    buildConfig?: BuildOptions;
}
