/**
* QueueEntry - A single entry in the event queue
*/
interface QueueEntry {
	/**
	* Unique cursor for this entry (monotonically increasing)
	* Format: "{timestamp_base36}-{sequence}"
	* Example: "lq5x4g2-0001"
	*/
	readonly cursor: string;
	/**
	* Topic this entry belongs to (e.g., sessionId, channelId)
	*/
	readonly topic: string;
	/**
	* The actual event payload
	*/
	readonly event: unknown;
	/**
	* Timestamp when the event was appended (Unix milliseconds)
	*/
	readonly timestamp: number;
}
/**
* Unsubscribe function
*/
type Unsubscribe = () => void;
/**
* EventQueue interface
*/
interface EventQueue {
	/**
	* Publish an event to a topic
	*
	* - Persists to SQLite (sync, fast)
	* - Broadcasts to all subscribers (in-memory)
	*
	* @param topic - Topic identifier (e.g., sessionId)
	* @param event - Event payload
	* @returns Cursor of the published entry
	*/
	publish(topic: string, event: unknown): string;
	/**
	* Subscribe to real-time events on a topic
	*
	* Receives events published after subscription.
	* For historical events, use recover() first.
	*
	* @param topic - Topic identifier
	* @param handler - Callback for each event entry
	* @returns Unsubscribe function
	*/
	subscribe(topic: string, handler: (entry: QueueEntry) => void): Unsubscribe;
	/**
	* Acknowledge consumption (update consumer cursor)
	*
	* Call this after successfully processing an event.
	* The cursor position is persisted for recovery.
	*
	* @param consumerId - Consumer identifier (e.g., connectionId)
	* @param topic - Topic identifier
	* @param cursor - Cursor of the consumed entry
	*/
	ack(consumerId: string, topic: string, cursor: string): Promise<void>;
	/**
	* Get consumer's current cursor position
	*
	* @param consumerId - Consumer identifier
	* @param topic - Topic identifier
	* @returns Cursor or null if consumer not found
	*/
	getCursor(consumerId: string, topic: string): Promise<string | null>;
	/**
	* Recover historical events from persistence
	*
	* Used for reconnection recovery - fetches events after a cursor.
	*
	* @param topic - Topic identifier
	* @param afterCursor - Start cursor (exclusive), omit for all history
	* @param limit - Maximum entries to return (default: 1000)
	* @returns Array of event entries
	*/
	recover(topic: string, afterCursor?: string, limit?: number): Promise<QueueEntry[]>;
	/**
	* Close the event queue and release resources
	*/
	close(): Promise<void>;
}
/**
* QueueOptions - Configuration for EventQueue
*/
interface QueueOptions {
	/**
	* Path to SQLite database file
	* Use ":memory:" for in-memory database (testing)
	*/
	path: string;
	/**
	* Message retention timeout (milliseconds)
	* Messages older than this are deleted during cleanup
	* @default 86400000 (24 hours)
	*/
	retentionMs?: number;
	/**
	* Cleanup interval (milliseconds)
	* Set to 0 to disable automatic cleanup
	* @default 300000 (5 minutes)
	*/
	cleanupIntervalMs?: number;
}
export { Unsubscribe, QueueOptions, QueueEntry, EventQueue };
