/**
 * Module: server/server-core
 *
 * Core HTTP server functionality shared between production and development servers
 */
import * as http from 'http';
import { IncomingMessage, ServerResponse } from 'http';
import type { Server as HttpsServer } from 'node:https';
import type { ParsedUrlQuery } from 'querystring';
import type { WebSocket } from 'ws';
import type { AuthConfig } from './auth';
export interface ServerConfig {
    port: number;
    host: string;
    mode: 'development' | 'production';
    tls?: {
        cert: string;
        key: string;
        certPath: string;
        keyPath: string;
    };
    clients?: Set<WebSocket>;
    staticRoot?: string;
    enableLiveReload?: boolean;
    auth?: AuthConfig;
}
export type HttpServerLike = http.Server | HttpsServer;
export interface RequestHandler {
    (req: IncomingMessage, res: ServerResponse, pathname: string, query: ParsedUrlQuery): Promise<boolean>;
}
/**
 * Core HTTP server class
 */
export declare class HttpServerCore {
    private server;
    private config;
    private customHandlers;
    private started;
    private stopping;
    constructor(config: ServerConfig);
    /**
     * Add custom request handler
     */
    addHandler(handler: RequestHandler): void;
    /**
     * Main request handler
     */
    private handleRequest;
    /**
     * Set CORS headers for development
     */
    private setCorsHeaders;
    /**
     * Send error response
     */
    private sendError;
    private sendUnauthorized;
    private sendApiNotFound;
    /**
     * Start the server on the configured port.
     */
    start(): Promise<number>;
    /**
     * Stop the server
     */
    stop(): Promise<void>;
    /**
     * Get the underlying HTTP server
     */
    getHttpServer(): HttpServerLike;
    getScheme(): 'http' | 'https';
    /**
     * Resolve dominds installation root
     */
    private resolveDomindsInstallRoot;
}
/**
 * Create and configure HTTP server
 */
export declare function createHttpServer(config: ServerConfig): HttpServerCore;
/**
 * Utility function to parse request body as JSON
 */
export declare function parseJsonBody(req: IncomingMessage): Promise<unknown>;
/**
 * Utility function to send JSON response
 */
export declare function sendJson(res: ServerResponse, statusCode: number, data: unknown): void;
/**
 * Utility function to send text response
 */
export declare function sendText(res: ServerResponse, statusCode: number, text: string): void;
