import type { Awareness } from 'y-protocols/awareness';
import type * as Y from 'yjs';
export type ConnectionType = 'webrtc' | 'websocket' | 'broadcast' | 'offline';
export type ConnectionStrategy = 'webrtc-first' | 'websocket-first' | 'webrtc-only' | 'websocket-only';
export interface ConnectionStatus {
    type: ConnectionType;
    connected: boolean;
    peers: number;
    broadcastChannelPeers?: number;
    webrtcPeers?: number;
    latency?: number;
    error?: string;
    tabRole?: 'leader' | 'follower' | 'standalone';
}
export interface UserInfo {
    id: string;
    sessionId: string;
    name?: string;
    color?: string;
    timestamp: number;
    [key: string]: unknown;
}
export interface PresenceInfo {
    users: Map<number, UserInfo>;
    localClientId: number | null;
    activeCount: number;
}
export interface SimpleSyncProviderOptions {
    room: string;
    ydoc: Y.Doc;
    webrtc?: {
        enabled?: boolean;
        signaling?: string[];
        password?: string;
        iceServers?: RTCIceServer[];
    };
    websocket?: {
        enabled?: boolean;
        url?: string;
    };
    iframe?: {
        enabled?: boolean;
        allowedOrigins?: string[];
    };
    awareness?: {
        enabled?: boolean;
        user?: Record<string, unknown>;
    };
    debug?: boolean;
}
export interface HybridSyncProviderOptions extends SimpleSyncProviderOptions {
    autoConnect?: boolean;
    reconnectTimeout?: number;
    connectionStrategy?: ConnectionStrategy;
    websocketFallbackDelay?: number;
    webrtc?: SimpleSyncProviderOptions['webrtc'] & {
        maxConns?: number;
        filterBcConns?: boolean;
        webrtcConnectionTimeout?: number;
    };
    websocket?: SimpleSyncProviderOptions['websocket'] & {
        params?: Record<string, string>;
        protocols?: string[];
    };
    awareness?: SimpleSyncProviderOptions['awareness'] & {
        user?: UserInfo;
    };
}
export interface SyncProvider {
    connect(): void;
    disconnect(): void;
    destroy(): void;
    getConnectionStatus(): ConnectionStatus;
    getAwareness(): Awareness | null;
    on(event: string, handler: (...args: unknown[]) => void): void;
    off(event: string, handler: (...args: unknown[]) => void): void;
}
export interface ModelConfig {
    room?: string;
    debug?: boolean;
    provider?: Partial<SimpleSyncProviderOptions>;
    initialValue?: unknown;
}
export type Unsubscribe = () => void;
export interface Todo {
    id: string;
    title: string;
    completed: boolean;
    createdAt: number;
    updatedAt: number;
    [key: string]: unknown;
}
