/**
 * Subscribe to a broadcasting channel.
 *
 * Connects to the stx broadcasting server via WebSocket, subscribes
 * to the named channel, and pushes every incoming event through the
 * reactive subscriber set.
 *
 * @param channelName - Channel to subscribe to (e.g. `'notifications'`, `'private-orders.123'`)
 * @param options     - Connection options (host, port, reconnect behaviour)
 */
export declare function useChannel<T = unknown>(channelName: string, options?: ChannelOptions): ChannelRef<T>;
/**
 * Broadcasting Channel Composables
 *
 * Reactive client-side subscriptions to ts-broadcasting channels.
 * Auto-connects to the stx broadcasting server, handles the WebSocket
 * protocol, and provides a subscriber-based reactive API.
 *
 * @example
 * ```ts
 * const channel = useChannel<{ count: number }>('metrics')
 *
 * channel.subscribe((state) => {
 *   console.log(state.data)        // latest event payload
 *   console.log(state.isSubscribed) // channel subscription status
 *   console.log(state.isConnected)  // WebSocket connection status
 * })
 *
 * // Listen for a specific event
 * channel.on('metrics.updated', (data) => {
 *   document.getElementById('cpu').textContent = data.cpu
 * })
 *
 * // Clean up
 * channel.close()
 * ```
 */
// ── Types ──────────────────────────────────────────────────────
export declare interface ChannelState<T = unknown> {
  data: T | null
  event: string | null
  isSubscribed: boolean
  isConnected: boolean
  socketId: string | null
}
export declare interface ChannelOptions {
  host?: string
  port?: number
  scheme?: 'ws' | 'wss'
  autoConnect?: boolean
  autoReconnect?: boolean
  maxReconnectAttempts?: number
  reconnectDelay?: number
}
export declare interface ChannelRef<T = unknown> {
  get: () => ChannelState<T>
  subscribe: (fn: (state: ChannelState<T>) => void) => () => void
  on: (event: string, callback: (data: any) => void) => () => void
  close: () => void
  open: () => void
}
// ── Helpers ────────────────────────────────────────────────────
declare global {
  interface Window {
  __stx_broadcasting?: { port?: number, host?: string, scheme?: string }
}
}
