import 'package:json_annotation/json_annotation.dart';

import '../../../apiParams.dart';

part 'getTimetableParams.g.dart';

@JsonSerializable(explicitToJson: true)
class GetTimetableParams extends ApiParams {
  GetTimetableParamsOptions options;

  GetTimetableParams({required this.options});

  factory GetTimetableParams.fromJson(Map<String, dynamic> json) => _$GetTimetableParamsFromJson(json);
  Map<String, dynamic> toJson() => _$GetTimetableParamsToJson(this);
}


@JsonSerializable(explicitToJson: true)
class GetTimetableParamsOptions {
  GetTimetableParamsOptionsElement element;
  @JsonKey(includeIfNull: false)
  int? startDate;
  @JsonKey(includeIfNull: false)
  int? endDate;
  @JsonKey(includeIfNull: false)
  bool? onlyBaseTimetable;
  @JsonKey(includeIfNull: false)
  bool? showBooking;
  @JsonKey(includeIfNull: false)
  bool? showInfo;
  @JsonKey(includeIfNull: false)
  bool? showSubstText;
  @JsonKey(includeIfNull: false)
  bool? showLsText;
  @JsonKey(includeIfNull: false)
  bool? showLsNumber;
  @JsonKey(includeIfNull: false)
  bool? showStudentgroup;
  @JsonKey(includeIfNull: false)
  List<GetTimetableParamsOptionsFields>? klasseFields;
  @JsonKey(includeIfNull: false)
  List<GetTimetableParamsOptionsFields>? roomFields;
  @JsonKey(includeIfNull: false)
  List<GetTimetableParamsOptionsFields>? subjectFields;
  @JsonKey(includeIfNull: false)
  List<GetTimetableParamsOptionsFields>? teacherFields;

  GetTimetableParamsOptions({
    required this.element,
    this.startDate,
    this.endDate,
    this.onlyBaseTimetable,
    this.showBooking,
    this.showInfo,
    this.showSubstText,
    this.showLsText,
    this.showLsNumber,
    this.showStudentgroup,
    this.klasseFields,
    this.roomFields,
    this.subjectFields,
    this.teacherFields
  });

  factory GetTimetableParamsOptions.fromJson(Map<String, dynamic> json) => _$GetTimetableParamsOptionsFromJson(json);
  Map<String, dynamic> toJson() => _$GetTimetableParamsOptionsToJson(this);
}

enum GetTimetableParamsOptionsFields {
  @JsonValue('id') id,
  @JsonValue('name') name,
  @JsonValue('longname') longname,
  @JsonValue('externalkey') externalkey;

  static List<GetTimetableParamsOptionsFields> all = [id, name, longname, externalkey];
}

@JsonSerializable()
class GetTimetableParamsOptionsElement {
  int id;
  int type;
  @JsonKey(includeIfNull: false)
  GetTimetableParamsOptionsElementKeyType? keyType;

  GetTimetableParamsOptionsElement({required this.id, required this.type, this.keyType});
  factory GetTimetableParamsOptionsElement.fromJson(Map<String, dynamic> json) => _$GetTimetableParamsOptionsElementFromJson(json);
  Map<String, dynamic> toJson() => _$GetTimetableParamsOptionsElementToJson(this);
}

enum GetTimetableParamsOptionsElementKeyType {
  @JsonValue('id') id,
  @JsonValue('name') name,
  @JsonValue('externalkey') externalkey
}
