import '../../marianumconnect_query.dart';
import 'user_search_response.dart';

/// Searches active users (students, teachers, staff) via the MarianumConnect
/// mobile API. Returns each match's Nextcloud username plus role, so the Talk
/// search can start a direct chat and label results without hitting Nextcloud.
class UserSearch extends MarianumConnectQuery {
  UserSearch({super.dio});

  Future<UserSearchResponse> run(String query) async => UserSearchResponse(
    result: await getList(
      'users/search',
      McUserSearchResult.fromJson,
      queryParameters: {'q': query},
    ),
  );
}
