import { RealtimeEvent } from "./index.js";
import { DurableObjectState, MessageBatch, Queue, WebSocket } from "@cloudflare/workers-types";
//#region src/server.d.ts
/** Stamp id + timestamp, fire-and-forget to a CF Queue. Never mutates the caller's object.
 *  Call via ctx.waitUntil(...) in a route handler. */
declare function publishEvent<E extends RealtimeEvent>(queue: Queue, event: Omit<E, 'id' | 'timestamp'>): Promise<void>;
/** Hibernatable accept. Supports BOTH accept mechanisms — host picks, module forces neither:
 *  - tags       → ctx.acceptWebSocket(ws, tags)
 *  - attachment → ws.serializeAttachment(attachment) after accept */
declare function acceptHibernatable(ctx: DurableObjectState, ws: WebSocket, opts?: {
  tags?: string[];
  attachment?: unknown;
}): void;
/** getWebSockets → safe send (ignore closed). targetTag scopes via getWebSockets(targetTag) only. */
declare function broadcastFrame(ctx: DurableObjectState, frame: string, opts?: {
  targetTag?: string;
  exclude?: WebSocket;
}): void;
/** Drain a queue batch → dispatch each event → ack on success, retry on throw. */
declare function makeQueueConsumer<E extends RealtimeEvent>(dispatch: (event: E, env: unknown) => Promise<void>): (batch: MessageBatch<E>, env: unknown) => Promise<void>;
/** Constant-time internal-secret check. Length-guard before timingSafeEqual. */
declare function verifyInternalSecret(provided: string | null, expected: string): boolean;
/** Participants minus those currently connected (mechanism-agnostic). */
declare function computeOffline(participantIds: readonly string[], online: ReadonlySet<string>): string[];
//#endregion
export { acceptHibernatable, broadcastFrame, computeOffline, makeQueueConsumer, publishEvent, verifyInternalSecret };