import { Broadcast, BroadcastServer, type ServerConfig } from 'ts-broadcasting';
import type { BroadcastingConfig } from './types/config-types';
export type {
  ServerConfig,
} from 'ts-broadcasting';
/**
 * Get the active BroadcastServer instance (or null if not started).
 */
export declare function getBroadcastServer(): BroadcastServer | null;
/**
 * Start the broadcasting WebSocket server.
 *
 * Called automatically by the stx dev-server when `broadcasting.enabled`
 * is true in stx.config.ts. You normally don't need to call this yourself.
 */
export declare function startBroadcasting(config: BroadcastingConfig): Promise<BroadcastServer>;
/**
 * Stop the broadcasting server and clean up resources.
 */
export declare function stopBroadcasting(): Promise<void>;
/**
 * Load and execute a `routes/channels.ts` file, wiring up every
 * channel definition to the running broadcasting server.
 *
 * Called automatically by the stx dev-server after `startBroadcasting()`.
 */
export declare function loadChannels(channelsPath: string): Promise<number>;
/**
 * Broadcast an event to a channel (or multiple channels).
 *
 * @example
 * ```ts
 * broadcast('chat', 'message.sent', { text: 'Hello!' })
 * broadcast(['chat', 'admin'], 'alert', { level: 'warn' })
 * ```
 */
export declare function broadcast<T = unknown>(channels: string | string[], event: string, data: T): void;
/**
 * Broadcast to a specific user's private channel.
 *
 * @example
 * ```ts
 * toUser(42, 'notification', { title: 'You have mail' })
 * ```
 */
export declare function toUser<T = unknown>(userId: string | number, event: string, data: T): void;
/**
 * Broadcast to multiple users.
 */
export declare function toUsers<T = unknown>(userIds: Array<string | number>, event: string, data: T): void;
/**
 * Broadcast to a private channel.
 */
export declare function broadcastPrivate<T = unknown>(channelName: string, event: string, data: T): void;
/**
 * Broadcast to a presence channel.
 */
export declare function broadcastPresence<T = unknown>(channelName: string, event: string, data: T): void;
// ── Types ──────────────────────────────────────────────────────
export declare interface ChannelDefinition<T = unknown> {
  event?: string
  interval?: number
  data?: () => T | Promise<T>
  authorize?: (socket: any, params: Record<string, string>) => boolean | object | Promise<boolean | object>
}
export declare interface ChannelRegistrar {
  channel: <T = unknown>(name: string, definition: ChannelDefinition<T>) => void
}
/**
 * Register channel authorization (ad-hoc, outside routes/channels.ts).
 */
export { channel } from 'ts-broadcasting';
// ── Re-exports for advanced usage ──────────────────────────────
export {
  Broadcast,
  BroadcastServer,
} from 'ts-broadcasting';
