// Version: 1.0.0 | Created: 2026-04-01
// Riverpod provider that streams the rooms list to the UI.

import 'package:riverpod_annotation/riverpod_annotation.dart';

import '../data/rooms_repository.dart';
import '../domain/room_model.dart';

part 'rooms_controller.g.dart';

/// Streams the rooms list. Rebuilds whenever Matrix sync produces changes.
@riverpod
Stream<List<RoomModel>> roomsList(Ref ref) {
  final repo = ref.watch(roomsRepositoryProvider);
  return repo.watchRooms();
}
