import { BrowserRouterOptions } from './types';
import { IKosDataModel, IKosIdentifiable, KosCreationContext, KosMethodTypes, KosMiddleware, PublicModelInterface } from '../../../core';

export declare const MODEL_TYPE = "browser-router-model";
/**
 * BrowserRouter - HTTP routing and middleware management for KOS web services.
 *
 * The BrowserRouter model provides a comprehensive HTTP routing system that handles incoming
 * requests via WebSocket topics and routes them through registered middleware and handlers.
 * It enables KOS applications to expose REST APIs, handle device communication, and manage
 * HTTP-based integrations with automatic OpenAPI specification generation.
 *
 * ## Key Features
 * - **Topic-Based HTTP Handling** - Processes HTTP requests via `kos.http.request` topic
 * - **Middleware Support** - Chain multiple middleware functions for request processing
 * - **Route Management** - Dynamic registration, removal, and inspection of routes
 * - **OpenAPI Generation** - Automatic API documentation at `/openapi.json`
 * - **Request/Response Abstraction** - Familiar Express.js-style request/response objects
 * - **Method Support** - Full HTTP method support (GET, POST, PUT, DELETE, PATCH)
 *
 * ## Topic-Based Reactivity
 * The model listens to these KOS topics for HTTP request handling:
 * - **`kos.http.request`** - Incoming HTTP requests from clients or other services
 * - **`kos.http.response`** - Outgoing HTTP responses with status codes and data
 *
 * ## Common Use Cases
 * - **REST API Endpoints** - Expose device data and control APIs
 * - **Webhook Handlers** - Process incoming webhooks from external services
 * - **Inter-Service Communication** - Handle requests between KOS services
 * - **Device Integration** - Bridge HTTP protocols with KOS messaging
 * - **API Gateway** - Route and transform requests to downstream services
 *
 * @interface
 * @example Basic Usage
 * ```typescript
 * const router = KosBrowserRouter.instance('main-router')
 *   .options({})
 *   .build();
 *
 * // Register HTTP endpoints with middleware support
 * router.use('GET', '/api/status', async (req, res) => {
 *   res.send({ status: 'online' });
 * });
 *
 * router.use('POST', '/api/commands', validateAuth, async (req, res) => {
 *   res.status(200).send({ success: true });
 * });
 * ```
 *
 * @group KOS Model
 * @category Browser Router
 * @category Service Integration
 * @useDeclaredType
 *
 * @see {@link BrowserRouterOptions} - Configuration options for BrowserRouter instances
 */
export type KosBrowserRouter = Omit<PublicModelInterface<BrowserRouterModelImpl>, "load" | "init">;
/**
 * @ignore
 * @internal
 */
export declare class BrowserRouterModelImpl implements IKosDataModel, IKosIdentifiable {
    /** Unique identifier for the router model instance */
    private _id;
    /** Context logger for debugging HTTP requests and routing */
    private logger;
    /** Internal HTTP router instance handling middleware chains */
    private router;
    constructor(modelId: string, _options: BrowserRouterOptions, context: KosCreationContext);
    /** Model instance identifier */
    get id(): string;
    /**
     * Handles incoming HTTP requests from WebSocket topics.
     * @param data Request body data
     * @param payload Request headers and metadata
     * @internal
     */
    private handleRequest;
    /**
     * Registers a route with optional middleware chain.
     * @param method HTTP method (GET, POST, PUT, DELETE, PATCH)
     * @param path Route path pattern with parameter support
     * @param middlewares Middleware functions and final handler
     */
    use<TPath extends string = string>(method: KosMethodTypes, path: TPath, ...middlewares: KosMiddleware<TPath>[]): void;
    /**
     * Remove routes matching the given method and path
     * @param method HTTP method (GET, POST, etc.)
     * @param path Route path pattern
     * @returns Number of routes removed
     */
    remove(method: KosMethodTypes, path: string): number;
    /**
     * Remove all routes matching a path pattern (regardless of method)
     * @param path Route path pattern
     * @returns Number of routes removed
     */
    removeAllForPath(path: string): number;
    /**
     * Gets all registered routes for debugging and monitoring.
     * @returns Array of route objects with method and path
     */
    getRoutes(): Array<{
        method: string;
        path: string;
    }>;
    /**
     * @internal
     */
    init(): Promise<void>;
    /**
     * @internal
     */
    load(): Promise<void>;
}
//# sourceMappingURL=browser-router-model.d.ts.map