<?php

declare(strict_types=1);

namespace Blax\WebRtc\Contracts;

use Blax\WebRtc\Realtime\OpenAiRealtimeBridge;

/**
 * A bidirectional text-frame link to an external realtime AI provider (its
 * WebSocket transport). Abstracted so {@see OpenAiRealtimeBridge}
 * is unit-testable with a scripted fake and swappable between blocking
 * (textalk/websocket) and loop-based clients.
 */
interface RealtimeTransport
{
    /** Send one JSON event to the provider. */
    public function send(string $text): void;

    /** Receive the next event, or null on timeout / close. */
    public function receive(): ?string;

    public function close(): void;
}
