import '../../marianumconnect/queries/user_search/user_search_response.dart';

/// Demo fixtures for the Talk user search — a small mixed set of teachers and
/// students, filtered client-side so the demo search feels responsive.
class DemoUsers {
  const DemoUsers._();

  static final List<McUserSearchResult> _all = [
    McUserSearchResult(
      username: 'm.muster',
      firstName: 'Maria',
      lastName: 'Mustermann',
      userType: 'TEACHER',
    ),
    McUserSearchResult(
      username: 'j.beispiel',
      firstName: 'Jonas',
      lastName: 'Beispiel',
      userType: 'TEACHER',
    ),
    McUserSearchResult(
      username: 'l.schueler',
      firstName: 'Lena',
      lastName: 'Schüler',
      userType: 'STUDENT',
      className: '9c',
    ),
    McUserSearchResult(
      username: 'p.probe',
      firstName: 'Paul',
      lastName: 'Probe',
      userType: 'STUDENT',
      className: 'Q2',
    ),
  ];

  static List<McUserSearchResult> search(String query) {
    final q = query.trim().toLowerCase();
    if (q.length < 2) return const [];
    return _all
        .where(
          (u) =>
              u.firstName.toLowerCase().contains(q) ||
              u.lastName.toLowerCase().contains(q) ||
              u.username.toLowerCase().contains(q) ||
              '${u.firstName} ${u.lastName}'.toLowerCase().contains(q),
        )
        .toList();
  }
}
