import 'package:json_annotation/json_annotation.dart';

import '../../../api_response.dart';

part 'user_search_response.g.dart';

@JsonSerializable(explicitToJson: true)
class McUserSearchResult {
  /// Nextcloud-/Talk-Username — dient als `invite` beim Chat-Start.
  final String username;
  final String firstName;
  final String lastName;

  /// STUDENT, TEACHER oder STAFF.
  final String userType;
  final String? className;

  McUserSearchResult({
    required this.username,
    required this.firstName,
    required this.lastName,
    required this.userType,
    this.className,
  });

  factory McUserSearchResult.fromJson(Map<String, dynamic> json) =>
      _$McUserSearchResultFromJson(json);
  Map<String, dynamic> toJson() => _$McUserSearchResultToJson(this);
}

@JsonSerializable(explicitToJson: true)
class UserSearchResponse extends ApiResponse {
  final List<McUserSearchResult> result;

  UserSearchResponse({required this.result});

  factory UserSearchResponse.fromJson(Map<String, dynamic> json) =>
      _$UserSearchResponseFromJson(json);
  Map<String, dynamic> toJson() => _$UserSearchResponseToJson(this);
}
