import { type DeploymentExposure, type DeploymentMode } from "@rudderhq/shared";
import { createServer } from "node:http";
import { type LocalRuntimeOwnerKind } from "./local-runtime.js";
export interface StartedServer {
    server: ReturnType<typeof createServer>;
    host: string;
    listenPort: number;
    apiUrl: string;
    databaseUrl: string;
    instancePaths: {
        homeDir: string;
        instanceRoot: string;
        configPath: string;
        envPath: string;
    };
    stop(): Promise<void>;
    dispose(): Promise<void>;
}
export interface ManagedStartedServer {
    host: string;
    listenPort: number;
    apiUrl: string;
    databaseUrl: string | null;
    instancePaths: StartedServer["instancePaths"];
    runtime: {
        mode: "owned" | "attached";
        instanceId: string;
        localEnv: string | null;
        ownerKind: LocalRuntimeOwnerKind | null;
        version: string;
        descriptorPath: string;
        lockPath: string;
        startedAt: string | null;
    };
    stop(): Promise<void>;
    dispose(): Promise<void>;
}
export type ServerBootstrapStage = "config" | "database" | "app" | "listening" | "ready" | "shutdown";
export interface ServerBootstrapEvent {
    stage: ServerBootstrapStage;
    message: string;
}
export interface ServerRuntimeOverrides {
    host?: string;
    port?: number;
    deploymentMode?: DeploymentMode;
    deploymentExposure?: DeploymentExposure;
    serveUi?: boolean;
    uiDevMiddleware?: boolean;
    heartbeatSchedulerEnabled?: boolean;
    databaseBackupEnabled?: boolean;
}
export interface StartServerOptions {
    runtimeOverrides?: ServerRuntimeOverrides;
    openOnListen?: boolean;
    printBanner?: boolean;
    onEvent?: (event: ServerBootstrapEvent) => void;
    runtimeOwnerKind?: LocalRuntimeOwnerKind | null;
}
export interface BootstrapCeoInviteOptions {
    dbUrl: string;
    force?: boolean;
    expiresHours?: number;
}
export interface BootstrapCeoInviteResult {
    token: string;
    expiresAt: Date;
}
export declare function checkDatabaseConnection(dbUrl: string): Promise<void>;
export declare function createBootstrapCeoInvite(options: BootstrapCeoInviteOptions): Promise<BootstrapCeoInviteResult | null>;
export interface StartManagedLocalServerOptions extends StartServerOptions {
    ownerKind: LocalRuntimeOwnerKind;
    takeoverOnVersionMismatch?: boolean;
    preferredOwner?: boolean;
    runtimeStartupLockTimeoutMs?: number;
    gracefulStopTimeoutMs?: number;
}
export declare function startManagedLocalServer(options: StartManagedLocalServerOptions): Promise<ManagedStartedServer>;
export declare function startServer(options?: StartServerOptions): Promise<StartedServer>;
//# sourceMappingURL=index.d.ts.map