/**
 * Real-time queue consumer — real-time-infrastructure spec.
 *
 * Drains the `zync-realtime` Cloudflare Queue. For each event, looks up the
 * tenant's DO (TenantRealtimeDO) and fans it out to connected WebSocket clients
 * via `broadcastToTenant`. Producers publish with
 * `publishRealtimeEvent(env.REALTIME_QUEUE, …)` from `@zync/realtime`.
 *
 * Decoupling the publish (route handler) from the fan-out (this consumer) is the
 * spec's Cloudflare-native pattern: routes never block on DO delivery, and the
 * queue absorbs bursts with retry/backoff.
 */
import type { Env } from '@zync/types'
import type { RealtimeEvent } from '@zync/realtime'
import { handlePlatformRealtimeBatch } from '../integrations/platform/realtime'

export async function handleRealtimeBatch(
  batch: MessageBatch<RealtimeEvent>,
  env: Env,
): Promise<void> {
  await handlePlatformRealtimeBatch(batch as never, env)
}
