import { RefObject } from 'react';

type ScreenReceiverRole = 'viewer' | 'broadcaster';
type ScreenReceiverClientRole = ScreenReceiverRole | 'sender';
type ScreenReceiverSignalType = 'offer' | 'answer' | 'ice';
interface ScreenReceiverJoinMessage {
    type: 'join';
    roomId: string;
    role?: ScreenReceiverClientRole;
    peerId?: string;
}
interface ScreenReceiverSignalMessage {
    type: ScreenReceiverSignalType;
    sdp?: string;
    candidate?: RTCIceCandidateInit;
    targetPeerId?: string;
}
type ScreenReceiverIncomingMessage = ScreenReceiverJoinMessage | ScreenReceiverSignalMessage | Record<string, unknown>;
interface ScreenReceiverJoinedMessage {
    type: 'joined';
    roomId: string;
    peerId: string;
    role: ScreenReceiverRole;
}
interface ScreenReceiverPeerJoinedMessage {
    type: 'peer_joined';
    roomId: string;
    peerId: string;
    role: ScreenReceiverRole;
}
interface ScreenReceiverPeerLeftMessage {
    type: 'peer_left';
    roomId: string;
    peerId: string;
}
interface ScreenReceiverRoomStateMessage {
    type: 'room_state';
    roomId: string;
    peers: Array<{
        peerId: string;
        role: ScreenReceiverRole;
    }>;
}
interface ScreenReceiverErrorMessage {
    type: 'error';
    reason: string;
}

interface ScreenReceiverLogEntry {
    id: number;
    text: string;
}
interface UseScreenReceiverOptions {
    wsUrl: string;
    roomId: string;
    iceServers?: RTCIceServer[];
    maxLogs?: number;
}
interface UseScreenReceiverReturn {
    connect: () => Promise<void>;
    disconnect: () => void;
    clearLogs: () => void;
    logs: ScreenReceiverLogEntry[];
    isConnected: boolean;
    connectionState: RTCPeerConnectionState | 'idle';
    iceConnectionState: RTCIceConnectionState | 'idle';
    videoRef: RefObject<HTMLVideoElement>;
    stream: MediaStream | null;
}
declare function useScreenReceiver(options: UseScreenReceiverOptions): UseScreenReceiverReturn;

interface ResolveScreenReceiverSignalUrlOptions {
    signalUrl?: string;
    path?: string;
    port?: number;
}
declare function resolveScreenReceiverSignalUrl(options?: ResolveScreenReceiverSignalUrlOptions): string;

export { type ResolveScreenReceiverSignalUrlOptions, type ScreenReceiverClientRole, type ScreenReceiverErrorMessage, type ScreenReceiverIncomingMessage, type ScreenReceiverJoinMessage, type ScreenReceiverJoinedMessage, type ScreenReceiverLogEntry, type ScreenReceiverPeerJoinedMessage, type ScreenReceiverPeerLeftMessage, type ScreenReceiverRole, type ScreenReceiverRoomStateMessage, type ScreenReceiverSignalMessage, type ScreenReceiverSignalType, type UseScreenReceiverOptions, type UseScreenReceiverReturn, resolveScreenReceiverSignalUrl, useScreenReceiver };
