import 'package:json_annotation/json_annotation.dart';

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

part 'timetable_get_teachers_response.g.dart';

/// Picker list entry for a teacher. Named `...Element` to avoid colliding with
/// `McTimetableteacher` from the week response, which models the teacher *of a
/// lesson* (with substitution fields) rather than a selectable element.
@JsonSerializable(explicitToJson: true)
class McTimetableTeacherElement {
  final int id;
  final String shortName;
  final String displayName;

  McTimetableTeacherElement({
    required this.id,
    required this.shortName,
    required this.displayName,
  });

  factory McTimetableTeacherElement.fromJson(Map<String, dynamic> json) =>
      _$McTimetableTeacherElementFromJson(json);
  Map<String, dynamic> toJson() => _$McTimetableTeacherElementToJson(this);
}

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

  TimetableGetTeachersResponse({required this.result});

  factory TimetableGetTeachersResponse.fromJson(Map<String, dynamic> json) =>
      _$TimetableGetTeachersResponseFromJson(json);
  Map<String, dynamic> toJson() => _$TimetableGetTeachersResponseToJson(this);
}
