<?php

declare(strict_types=1);

namespace Blax\WebRtc\Media;

use Blax\WebRtc\Contracts\MediaEngine;

/**
 * A no-op media engine so the signaling stack is runnable and testable before
 * the Rust media core exists. It accepts signaling and logs, but does NOT
 * terminate media — any `offer()` fails loudly so a misconfigured deployment is
 * obvious rather than silently medialess.
 */
final class NullMediaEngine implements MediaEngine
{
    public function name(): string
    {
        return 'null';
    }

    public function offer(string $peerId, string $sdpOffer): string
    {
        throw new \RuntimeException(
            'NullMediaEngine cannot terminate media. Configure webrtc.media_engine '.
            'to RustMediaEngine (the bundled Rust SFU sidecar) for backend-hosted calls.'
        );
    }

    public function addIceCandidate(string $peerId, array $candidate): void
    {
        // no-op
    }

    public function startRecording(string $peerId, string $path): void
    {
        // no-op
    }

    public function stopRecording(string $peerId): void
    {
        // no-op
    }

    public function connectPeers(string $peerA, string $peerB): void
    {
        // no-op
    }

    public function bridge(string $peerId, array $options): void
    {
        // no-op
    }

    public function close(string $peerId): void
    {
        // no-op
    }
}
