import { AnsiLogger } from 'matterbridge/logger';
import { PlatformConfigManager } from '../platform/platformConfigManager.js';
import { Device, UserData } from '../roborockCommunication/models/index.js';
import { Client } from '../roborockCommunication/routing/client.js';
import { ClientRouter } from '../roborockCommunication/routing/clientRouter.js';
import type { DeviceNotifyCallback } from '../types/index.js';
import ClientManager from './clientManager.js';
import { MessageRoutingService } from './messageRoutingService.js';
/** Manages device connections (MQTT and local network). */
export declare class ConnectionService {
    private readonly clientManager;
    private readonly logger;
    private readonly messageRoutingService;
    private readonly configManager?;
    clientRouter: ClientRouter | undefined;
    ipMap: Map<string, string>;
    localClientMap: Map<string, Client>;
    deviceNotify: DeviceNotifyCallback | undefined;
    private emailService;
    constructor(clientManager: ClientManager, logger: AnsiLogger, messageRoutingService: MessageRoutingService, configManager?: PlatformConfigManager | undefined);
    sendTestEmailNotification(): Promise<void>;
    private getEmailService;
    /** Set callback for device notifications. */
    setDeviceNotify(callback: DeviceNotifyCallback): void;
    /** Wait for connection with retry logic. Returns attempt count. */
    waitForConnection(checkConnection: () => boolean, maxAttempts?: number, delayMs?: number): Promise<number>;
    /**
     * Initialize the message client for cloud/MQTT communication.
     * Registers device, sets up message listeners, and waits for connection.
     */
    initializeMessageClient(device: Device, userdata: UserData): Promise<void>;
    /**
     * Initialize local network client for direct device communication.
     * Creates message processor, retrieves device IP, and establishes local connection.
     * Devices with protocol version B01 will skip local connection and use MQTT only.
     */
    initializeMessageClientForLocal(device: Device): Promise<boolean>;
    /**
     * Get the current message client instance.
     * @returns The active ClientRouter or undefined if not initialized
     */
    getMessageClient(): ClientRouter | undefined;
    /**
     * Shutdown all connections and cleanup resources.
     */
    shutdown(): Promise<void>;
    /**
     * Sleep for specified milliseconds.
     * @param ms - Milliseconds to sleep
     */
    private sleep;
    /**
     * Helper: Set up a local client for the given device and IP.
     */
    private setupLocalClient;
    /**
     * Extract network info from device status.
     */
    private getNetworkInfoFromDeviceStatus;
}
//# sourceMappingURL=connectionService.d.ts.map