import { EventEmitter } from 'events';
import { IConfig } from '../models/IConfig';
import { TibberQueryBase } from './TibberQueryBase';
export declare class TibberFeed extends EventEmitter {
    private _operationId;
    private _feedConnectionTimeout;
    private _feedIdleTimeout;
    private _config;
    private _active;
    private _isConnected;
    private _isConnecting;
    private _gql;
    private _webSocket;
    private _tibberQuery;
    private _timerHeartbeat;
    private _timerConnect;
    private _timerConnectionTimeout;
    private _isClosing;
    private _isUnauthenticated;
    private _headerManager;
    private _lastRetry;
    private _retryBackoff;
    private _connectionAttempts;
    private _backoffDelayBase;
    private _backoffDelayMax;
    private _realTimeConsumptionEnabled?;
    private _timeoutCount;
    get timeoutCount(): number;
    /**
     * Constructor for creating a new instance if TibberFeed.
     * @constructor
     * @param {TibberQueryBase} tibberQuery TibberQueryBase object.
     * @param {number} timeout Feed idle timeout in milliseconds. The feed will reconnect after being idle for more than the specified number of milliseconds. Min 5000 ms.
     * @param {boolean} returnAllFields Specify if you want to return all fields from the data feed.
     * @param {number} connectionTimeout Feed connection timeout.
     * @see {@linkcode TibberQueryBase}
     */
    constructor(tibberQuery: TibberQueryBase, timeout?: number, returnAllFields?: boolean, connectionTimeout?: number);
    get active(): boolean;
    set active(value: boolean);
    get connected(): boolean;
    get feedIdleTimeout(): number;
    set feedIdleTimeout(value: number);
    get feedConnectionTimeout(): number;
    set feedConnectionTimeout(value: number);
    get queryRequestTimeout(): number;
    set queryRequestTimeout(value: number);
    get config(): IConfig;
    set config(value: IConfig);
    private get canConnect();
    /**
     * PUBLIC METHODS
     * ----------------
     * These methods are used to interact with the TibberFeed.
     * ----------------
     * */
    /**
     * Connect to Tibber feed.
     */
    connect(): Promise<void>;
    /**
     * Close the Tibber feed.
     */
    close(): void;
    /**
     * Heartbeat function used to keep connection alive.
     * Mostly for internal use, even if it is public.
     */
    heartbeat(): void;
    /**
     * PRIVATE METHODS
     * ----------------
     * These methods are used internally by the TibberFeed.
     * ----------------
     * */
    /**
     * Generate random number with a max value.
     * @param {number} max Maximum number
     * @returns {number} Random number.
     */
    private getRandomInt;
    /**
     * Exponential backoff with jitter
     * @param {number} attempt Connection attempt
     * @returns {number}
     */
    private getBackoffWithJitter;
    /**
     * Decreases the connection backoff.
     */
    private decreaseConnectionBackoff;
    /**
     * Add a timeout to an array of timeouts.
     * @param {NodeJS.Timeout[]} timers List og timeouts
     * @param {void} callback Callback function to call when timeout is reached.
     * @param {number} delayMs Delay in milliseconds before callback will be called.
     */
    private addTimeout;
    /**
     * Clear timeout for a timer.
     * @param {NodeJS.Timeout[]} timers Timer handle to clear
     */
    private cancelTimeouts;
    /**
     * Connect to feed with built in delay, timeout and backoff.
     */
    private connectWithTimeout;
    /**
     * Connect with a delay if the feed is still active.
     */
    private connectWithDelayWorker;
    /**
     * Internal connection method that handles the communication with tibber feed.
     */
    private internalConnect;
    /**
     * Event: onWebSocketOpen
     * Called when websocket connection is established.
     */
    private onWebSocketOpen;
    /**
     * Event: onWebSocketClose
     * Called when feed is closed.
     * @param {WebSocket.CloseEvent} event Close event
     */
    private onWebSocketClose;
    /**
     * Event: onWebSocketMessage
     * Called when data is received from the feed.
     * @param {WebSocket.MessageEvent} event Message event
     */
    private onWebSocketMessage;
    /**
     * Event: onWebSocketError
     * Called when an error has occurred.
     * @param {WebSocket.ErrorEvent} event Error event
     */
    private onWebSocketError;
    /**
     * Gracefully close connection with Tibber.
     */
    private closeConnection;
    /**
     * Forcefully terminate connection with Tibber.
     */
    private terminateConnection;
    /**
     * Initialize connection with Tibber.
     */
    private initConnection;
    /**
     * Subscribe to a specified resource.
     * @param subscription @typedef string Name of the resource to subscribe to.
     * @param variables @typedef Record<string, unknown> Variable to use with the resource.
     */
    private startSubscription;
    /**
     * Stops subscribing to a resource with a specified operation Id
     * @param {number} operationId Operation Id to stop subscribing to.
     */
    private stopSubscription;
    /**
     * Send websocket query to Tibber
     * @param {IQuery} query Tibber GQL query
     */
    private sendQuery;
    /**
     * Log function to emit log data to subscribers.
     * @param {string} message Log message
     */
    private log;
    /**
     * Log function to emit warning log data to subscribers.
     * @param {string} message Log message
     */
    private warn;
    /**
     * Log function to emit error log data to subscribers.
     * @param {any} message Log message
     */
    private error;
}
