/**
 * Copyright 2024 Mytra Control S.L. All rights reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
 * or at https://opensource.org/licenses/MIT.
 */
import { Layer } from '@mdf.js/core';
import { LoggerInstance } from '@mdf.js/logger';
import { Client, Config } from './types';
export { IClientPublishOptions, IPublishPacket } from 'mqtt';
/** MQTT port implementation */
export declare class Port extends Layer.Provider.Port<Client, Config> {
    /** MQTT connection handler */
    private readonly instance;
    /** Connection flag */
    private isConnected;
    /** Port health status */
    private isHealthy;
    /** Ping checker interval */
    private connectionChecker;
    /**
     * Implementation of functionalities of an MQTT port instance.
     * @param config - Port configuration options
     * @param logger - Port logger, to be used internally
     */
    constructor(config: Config, logger: LoggerInstance);
    /** Return the underlying port instance */
    get client(): Client;
    /** Return the port state as a boolean value, true if the port is available, false in otherwise */
    get state(): boolean;
    /** Initialize the port instance */
    start(): Promise<void>;
    /** Stop the port instance */
    stop(): Promise<void>;
    /** Close the port instance */
    close(): Promise<void>;
    /** Update the state of the connection*/
    private readonly checkConnectionStatus;
    /**
     * Manage the event of a new connection or reconnection to the MQTT broker.
     * @param connectACK - MQTT connection acknowledgement packet
     */
    private readonly onConnect;
    /** Manage the event of a new reconnection to the MQTT broker. */
    private readonly onReconnect;
    /** Manage the event of a new disconnection to the MQTT broker. */
    private readonly onClose;
    /**
     * Manage the event of a new disconnection to the MQTT broker.
     * @param packet - MQTT disconnection packet
     */
    private readonly onDisconnect;
    /** Manage the event of a new offline state in the MQTT connection. */
    private readonly onOffline;
    /**
     * Update the last error in the port instance.
     * @param rawError - Error object
     * @returns Crash or Multi object
     */
    private readonly updateLastError;
    /**
     * Manage the event of a new error in the MQTT connection.
     * @param rawError - Error object
     */
    private readonly onError;
    /**
     * Attach all the events and log for debugging
     * @param instance - client where the event managers will be attached
     */
    private eventsWrapping;
    /**
     * Remove all the events listeners
     * @param instance - client where the event managers will be unattached
     */
    private eventsUnwrapping;
}
//# sourceMappingURL=Port.d.ts.map