import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:uuid/uuid.dart';

import 'package:asr_client/models/websocket_message.dart';
import 'package:asr_client/services/livekit_service.dart';

final liveKitServiceProvider = Provider<LiveKitService>((ref) {
  throw UnimplementedError('Override in app bootstrap');
});

final liveKitRoomNameProvider = Provider<String>((ref) {
  return 'asr-${const Uuid().v4().substring(0, 8)}';
});

final liveKitMessageStreamProvider = StreamProvider<ServerMessage>((ref) {
  final service = ref.watch(liveKitServiceProvider);
  return service.messageStream;
});
