import { default as Long } from 'long';
import { MtClientOptions, MtClient } from '../network/client.js';
import { ConnectionKind, RpcCallOptions } from '../network/network-manager.js';
import { StorageManagerExtraOptions } from '../storage/storage.js';
import { ICorePlatform } from '../types/platform.js';
import { MustEqual } from '../types/utils.js';
import { ICryptoProvider, InputStringSessionData, Logger } from '../utils/index.js';
import { ConnectionState, ITelegramClient } from './client.types.js';
import { ITelegramStorageProvider } from './storage/provider.js';
import { TelegramStorageManagerExtraOptions, TelegramStorageManager } from './storage/storage.js';
import { RawUpdateInfo, UpdatesManagerParams } from './updates/types.js';
import { Emitter } from '@fuman/utils';
import { tl } from '../tl/index.js';
import { AppConfigManager } from './managers/app-config-manager.js';
import { TimersManager } from './managers/timers.js';
import { UpdatesManager } from './updates/manager.js';
export interface BaseTelegramClientOptions extends MtClientOptions {
    storage: ITelegramStorageProvider;
    storageOptions?: StorageManagerExtraOptions & TelegramStorageManagerExtraOptions;
    updates?: UpdatesManagerParams | false;
}
export declare class BaseTelegramClient implements ITelegramClient {
    #private;
    readonly params: BaseTelegramClientOptions;
    readonly updates?: UpdatesManager;
    readonly log: Logger;
    readonly mt: MtClient;
    readonly crypto: ICryptoProvider;
    readonly storage: TelegramStorageManager;
    readonly platform: ICorePlatform;
    readonly timers: TimersManager;
    readonly onServerUpdate: Emitter<tl.TypeUpdates>;
    readonly onRawUpdate: Emitter<RawUpdateInfo>;
    readonly onConnectionState: Emitter<ConnectionState>;
    constructor(params: BaseTelegramClientOptions);
    readonly appConfig: AppConfigManager;
    private _prepare;
    /**
     * **ADVANCED**
     *
     * Do all the preparations, but don't connect just yet.
     * Useful when you want to do some preparations before
     * connecting, like setting up session.
     *
     * Call {@link connect} to actually connect.
     */
    prepare(): Promise<void>;
    private _connected;
    private _connect;
    /**
     * Initialize the connection to the primary DC.
     *
     * You shouldn't usually call this method directly as it is called
     * implicitly the first time you call {@link call}.
     */
    connect(): Promise<void>;
    get isConnected(): boolean;
    disconnect(): Promise<void>;
    destroy(): Promise<void>;
    get destroyed(): boolean;
    [Symbol.asyncDispose](): Promise<void>;
    notifyLoggedIn(auth: tl.auth.TypeAuthorization | tl.RawUser): Promise<tl.RawUser>;
    notifyLoggedOut(): Promise<void>;
    notifyChannelOpened(channelId: number, pts?: number): Promise<boolean>;
    notifyChannelClosed(channelId: number): Promise<boolean>;
    startUpdatesLoop(): Promise<void>;
    stopUpdatesLoop(): Promise<void>;
    /**
     * Make an RPC call
     *
     * This method is still quite low-level and you shouldn't use this
     * when using high-level API provided by `@mtcute/client`.
     *
     * @param message  RPC method to call
     * @param params  Additional call parameters
     */
    call<T extends tl.RpcMethod>(message: MustEqual<T, tl.RpcMethod>, params?: RpcCallOptions): Promise<tl.RpcCallReturn[T['_']]>;
    /**
     * Import the session from the given session string.
     *
     * Note that the session will only be imported in case
     * the storage is missing authorization (i.e. does not contain
     * auth key for the primary DC), otherwise it will be ignored (unless `force`).
     *
     * @param session  Session string to import
     * @param force  Whether to overwrite existing session
     */
    importSession(session: string | InputStringSessionData, force?: boolean): Promise<void>;
    /**
     * Export current session to a single *LONG* string, containing
     * all the needed information.
     *
     * > **Warning!** Anyone with this string will be able
     * > to authorize as you and do anything. Treat this
     * > as your password, and never give it away!
     * >
     * > In case you have accidentally leaked this string,
     * > make sure to revoke this session in account settings:
     * > "Privacy & Security" > "Active sessions" >
     * > find the one containing `mtcute` > Revoke,
     * > or, in case this is a bot, revoke bot token
     * > with [@BotFather](//t.me/botfather)
     */
    exportSession(): Promise<string>;
    onError: Emitter<Error>;
    handleClientUpdate(updates: tl.TypeUpdates, noDispatch?: boolean): void;
    getApiCredentials(): Promise<{
        id: number;
        hash: string;
    }>;
    getPoolSize(kind: ConnectionKind, dcId?: number): Promise<number>;
    getPrimaryDcId(): Promise<number>;
    computeSrpParams(request: tl.account.RawPassword, password: string): Promise<tl.RawInputCheckPasswordSRP>;
    computeNewPasswordHash(algo: tl.TypePasswordKdfAlgo, password: string): Promise<Uint8Array>;
    get stopSignal(): AbortSignal;
    changePrimaryDc(dcId: number): Promise<void>;
    getMtprotoMessageId(): Promise<Long>;
    recreateDc(dcId: number): Promise<void>;
}
