import { KosLogManagerOptions, LogLevelDescriptor, LogOverride } from './types';
import { PublicModelInterface } from '../../../core/types';
import { IKosIdentifiable } from '../../../core/core/types';
import { IKosDataModel, KosCreationContext } from '../../../core/core/kosModel';
import { ApiCallbackWithWildcard } from '../../../core/core/decorators';
import { KosRequest, KosResponse } from '../../../core';

/**
 * Model type identifier for the KOS Log Manager
 */
export declare const MODEL_TYPE = "kos-log-manager-model";
/**
 * KOS Log Manager Model - Centralized runtime log level management for the entire KOS system.
 *
 * This singleton model provides comprehensive control over logging behavior across the KOS UI SDK
 * and connected applications. It manages dynamic log level overrides, responds to real-time
 * configuration changes, and provides both REST API and WebSocket interfaces for log management.
 * Essential for debugging, performance monitoring, and production troubleshooting.
 *
 * ## Key Features
 * - **Runtime Log Level Control** - Dynamically adjust log levels without application restart
 * - **Hierarchical Logger Management** - Apply overrides to parent loggers and all children
 * - **Real-time Configuration** - WebSocket-based updates propagate instantly across clients
 * - **REST API Integration** - Query and manage logger configurations via HTTP endpoints
 * - **Override Persistence** - Log overrides are maintained across sessions and page refreshes
 * - **Multi-Node Support** - Coordinate logging across different KOS device nodes
 *
 * ## Topic-Based Reactivity
 * The model listens to these KOS topics for real-time log management:
 * - **`/kos/logs/override/add/*`** - Fired when new log level overrides are created
 * - **`/kos/logs/override/remove/*`** - Fired when log level overrides are removed
 *
 * Both topics support wildcard capture for node type targeting, enabling precise
 * control over which device nodes receive logging configuration changes.
 *
 * ## Architecture Integration
 * The log manager integrates with the broader KOS logging ecosystem:
 * - **KosLog System** - Manages underlying logger instances and level settings
 * - **LogStreamModel** - Streams managed by this model's log level policies
 * - **LogBlockModel** - Individual log entries governed by level settings
 * - **REST Endpoints** - Provides `/api/kos/ui/loggers` for external access
 *
 * ## Common Use Cases
 * - **Development Debugging** - Increase log verbosity for specific components during development
 * - **Production Troubleshooting** - Temporarily enable debug logging to diagnose issues
 * - **Performance Monitoring** - Adjust log levels to reduce overhead in production
 * - **System Administration** - Centrally manage logging across distributed KOS deployments
 * - **Dynamic Configuration** - Change logging behavior without service interruption
 * - **Selective Logging** - Enable detailed logging for specific modules while keeping others quiet
 *
 * @interface
 * @example Basic Usage
 * ```typescript
 * const logManager = KosLogManager.instance('log-control').build();
 *
 * // Get all current logger configurations via REST API
 * const loggers = await logManager.getAllLoggers();
 * console.log(`Managing ${loggers.length} loggers`);
 * ```
 *
 * @group KOS Model
 * @category Device Logging
 * @useDeclaredType
 *
 * @see {@link LogStreamModel} - Streams whose content is governed by log levels managed here
 * @see {@link LogBlockModel} - Individual log entries affected by level settings
 * @see {@link KosLogManagerOptions} - Configuration options for the log manager
 * @see {@link LogOverride} - Log level override structure for runtime control
 * @see {@link LogLevelDescriptor} - Logger information structure returned by REST API
 */
export type KosLogManagerModel = PublicModelInterface<KosLogManagerModelImpl>;
/**
 * @ignore
 * @internal
 */
export declare class KosLogManagerModelImpl implements IKosDataModel, IKosIdentifiable {
    id: string;
    private logger;
    private _overrides;
    constructor(modelId: string, options: KosLogManagerOptions, context: KosCreationContext);
    updateModel(_options: KosLogManagerOptions): void;
    /**
     * Resolves all registered loggers and their current log levels.
     * @returns A map of logger names to their log level descriptors
     * @private
     */
    private resolveLoggers;
    /**
     * REST API endpoint to retrieve all logger configurations.
     * @get /api/kos/ui/loggers
     * @param _req - The incoming request (unused)
     * @param res - The response object to send logger data
     * @returns Array of log level descriptors for all loggers
     */
    getAllLoggers(_req?: KosRequest, res?: KosResponse): Promise<LogLevelDescriptor[]>;
    /**
     * Applies a log level override to matching loggers.
     * Sets the specified log level for the logger and all child loggers
     * whose names start with the override name.
     * @param override - The log override configuration to apply
     * @private
     */
    private setLogLevels;
    /**
     * Resets log levels to their defaults for matching loggers.
     * Removes the override for the logger and all child loggers
     * whose names start with the override name.
     * @param override - The log override configuration to reset
     * @private
     */
    private resetLogLevels;
    /**
     * WebSocket handler for log override addition events.
     * Listens to: /kos/logs/override/add/*
     * @param override - The log override to add
     * @param payload - Contains wildcard capture data including nodeType
     */
    handleOverrideAdded(override: LogOverride, payload: ApiCallbackWithWildcard<any>): void;
    /**
     * WebSocket handler for log override removal events.
     * Listens to: /kos/logs/override/remove/*
     * @param override - The log override to remove
     */
    handleOverrideRemoved(override: LogOverride): void;
    /**
     * Initializes the log manager model.
     * Called during model creation lifecycle.
     * @internal
     */
    init(): Promise<void>;
    /**
     * Loads existing log overrides from the server.
     * Fetches UI-specific overrides and applies them to the current loggers.
     * Called after model initialization.
     * @internal
     */
    load(): Promise<void>;
}
//# sourceMappingURL=kos-log-manager-model.d.ts.map