import 'package:json_annotation/json_annotation.dart';

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

part 'timetable_get_subjects_response.g.dart';

@JsonSerializable(explicitToJson: true)
class McSubject {
  final int id;
  final String shortName;
  final String longName;

  /// Persönliche Fach-Farbe (Palette-Name aus [SubjectColor]), serverseitig pro
  /// Nutzer gepflegt. `null`, wenn für dieses Fach keine Farbe gesetzt ist.
  final String? color;

  McSubject({
    required this.id,
    required this.shortName,
    required this.longName,
    this.color,
  });

  factory McSubject.fromJson(Map<String, dynamic> json) =>
      _$McSubjectFromJson(json);
  Map<String, dynamic> toJson() => _$McSubjectToJson(this);
}

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

  TimetableGetSubjectsResponse({required this.result});

  factory TimetableGetSubjectsResponse.fromJson(Map<String, dynamic> json) =>
      _$TimetableGetSubjectsResponseFromJson(json);
  Map<String, dynamic> toJson() => _$TimetableGetSubjectsResponseToJson(this);
}
