import { LogLevelConfig } from '@appium/types';
import { ChildProcess } from 'child_process';
import type { AlternativeForkFunction, AlternativeForkProcess } from './types';
declare global {
    var __APPIUM_SERVER__: AppiumServerInstance;
}
export declare enum ServerStatus {
    running = "running",
    stopped = "stopped"
}
export interface RunAppiumServerLogMessage {
    type: string;
    payload?: {
        logLevel: string;
        log: string;
    };
}
export declare enum AppiumSeverEvent {
    RUN_APPIUM_SERVER_DEAD = "run-appium-server-dead",
    RUN_APPIUM_SERVER_SHUTTING_DOWN = "run-appium-server-shutting-down",
    RUN_APPIUM_SERVER_STARTED = "run-appium-server-started",
    RUN_APPIUM_SERVER_STARTING = "run-appium-server-starting",
    RUN_APPIUM_SERVER_STILL_SHUTTING_DOWN = "run-appium-server-still-shutting-down",
    RUN_APPIUM_SERVER_STILL_STARTING = "run-appium-server-still-starting"
}
export declare enum InferredAppiumServerStatusEvent {
    APK_INSTALLED = "apk-installed",
    CONNECTED_TO_DEVICE = "connected-to-device",
    CONNECTING_TO_ANDROID_DEVICE = "connecting-to-android-device",
    CONNECTING_TO_IOS_DEVICE = "connecting-to-ios-device",
    DRIVERS_LOADED = "drivers-found",
    LOADING_DRIVERS = "loading-drivers",
    SETTING_UP_SIMULATOR = "setting-up-simulator",
    SIMULATOR_BOOTED = "simulator-booted",
    STARTING_MJPEG_STREAM = "starting-mjpeg-stream",
    STILL_CONNECTING_TO_ANDROID_DEVICE = "still-connecting-to-android-device",
    STILL_CONNECTING_TO_IOS_DEVICE = "still-connecting-to-ios-device",
    WEBVIEW_CHROME_DRIVER_DOWNLOAD = "webview-chrome-driver-download",
    WEBVIEW_CHROME_DRIVER_DOWNLOAD_COMPLETE = "webview-chrome-driver-download-complete"
}
export interface AppiumServerInstanceConfig {
    androidHome?: string;
    address?: string;
    allowCors?: boolean;
    port?: number;
    loglevel?: LogLevelConfig;
    logHandler?: (logLevel: string, logLine: string) => void;
    serverEventHandler?: (event: InferredAppiumServerStatusEvent | AppiumSeverEvent) => void;
    appiumHome?: string;
    noPermsCheck?: boolean;
    runAppiumServerPath?: string;
    alternativeFork?: AlternativeForkFunction;
}
export declare class AppiumServerInstance {
    private server?;
    private serverConfig;
    private serverStatus;
    private serverEventRateLimitTracker;
    private minTimeBetweenRepeatedEventsInMillis;
    constructor(serverOptions: AppiumServerInstanceConfig);
    getStatus(): ServerStatus;
    getServer(): ChildProcess | AlternativeForkProcess | undefined;
    start(): Promise<void>;
    static maybeEmitInferredEventFromMessage(message: RunAppiumServerLogMessage, serverEventHandlerFunc?: (inferredEvent: InferredAppiumServerStatusEvent) => void): void;
    emitRateLimitedEvent(event: InferredAppiumServerStatusEvent | AppiumSeverEvent, serverEventRateLimitTracker: {
        [key: string | InferredAppiumServerStatusEvent | AppiumSeverEvent]: number;
    }, minTimeBetweenRepeatedEventsInMillis: number): void;
    maybeEmitAppiumServerEvent(event: AppiumSeverEvent): void;
    waitForServerStatusMessage(status: ServerStatus, maxTimeMillis?: number): Promise<void>;
    stop(): Promise<void>;
    sendMessageToServer(message: string): void;
}
//# sourceMappingURL=AppiumServerInstance.d.ts.map