package com.foxx.androidcast.network.webrtc;

/*********************************************************************
 * WebRtcCastTransport.java
 * Created at: Sat 16 May 2026 18:50:36 +0200
 * Updated at: Wed 20 May 2026 15:17:13 +0200 by Anton Afanasyeu <a.afanasieff@gmail.com>
 * Commit: 5d8e82d2e60a21fff3138d2a394ee4e8b4c6dcb8
 * interface WebRtcCastTransport
 * Contributors:
 *    - Anton Afanasyeu <a.afanasieff@gmail.com> (2 commits, 69 lines)
 *    - Cursor Agent (project assistant)
 * Digest: SHA256	af151a4dd6ea8e576648e3c4861d851eb9e85c04bdb3bdee18e1344af52beede
**********************************************************************/
import com.foxx.androidcast.network.CastProtocol;
import com.foxx.androidcast.network.CastTransport;

import java.io.IOException;

/**
 * Future WebRTC transport (libwebrtc or pion-backed). Not wired yet — use {@link #createStub()}.
 */
public interface WebRtcCastTransport extends CastTransport {

    /** Signaling / ICE configuration for upcoming integration. */
    interface SignalingConfig {
        String getSignalingUrl();

        String[] getIceServers();
    }

    /** Attach when integrating real PeerConnection / DataChannel. */
    void attachPeer(WebRtcPeerAdapter peer);

    /**
     * Placeholder until libwebrtc or pion transport is connected.
     */
    static WebRtcCastTransport createStub() {
        return new WebRtcCastTransportStub();
    }

    final class WebRtcCastTransportStub implements WebRtcCastTransport {
        @Override
        public void attachPeer(WebRtcPeerAdapter peer) {}

        @Override
        public void listen(int port) throws IOException {
            throw new UnsupportedOperationException("WebRTC transport is not implemented yet");
        }

        @Override
        public void connect(String host, int port) throws IOException {
            throw new UnsupportedOperationException("WebRTC transport is not implemented yet");
        }

        @Override
        public void send(byte type, byte[] payload) throws IOException {
            throw new UnsupportedOperationException("WebRTC transport is not implemented yet");
        }

        @Override
        public CastProtocol.Message receive(int timeoutMs) throws IOException {
            throw new UnsupportedOperationException("WebRTC transport is not implemented yet");
        }

        @Override
        public String getModeLabel() {
            return "WebRTC (stub)";
        }

        @Override
        public void close() {}
    }
}
