import type { ReplayStreamQueryRequest } from '../model/track.types';

export interface ReplayStreamHandlers {
  onConnected?: () => void;
  onDisconnected?: () => void;
  onError?: (error: Error) => void;
  onChunk?: (chunk: unknown) => void;
  onCompleted?: () => void;
}

class ReplayStreamService {
  private readonly enabled = String(import.meta.env.VITE_TRACKING_WS_ENABLED || 'false') === 'true';

  async connect(handlers?: ReplayStreamHandlers): Promise<boolean> {
    void handlers;
    if (!this.enabled) return false;
    return false;
  }

  async startQuery(request: ReplayStreamQueryRequest): Promise<boolean> {
    void request;
    if (!this.enabled) return false;
    return false;
  }

  async cancel(): Promise<void> {
    if (!this.enabled) return;
  }

  disconnect(): void {
    if (!this.enabled) return;
  }
}

export const replayStreamService = new ReplayStreamService();
