import 'package:json_annotation/json_annotation.dart';

part 'job_report_question_deatil_model.g.dart';

@JsonSerializable()
class JobReportQuestionDeatilModel extends Object {
  @JsonKey(name: 'jobName')
  String? jobName;

  @JsonKey(name: 'schoolId')
  int schoolId;

  @JsonKey(name: 'schoolName')
  String schoolName;

  @JsonKey(name: 'gradeId')
  int gradeId;

  @JsonKey(name: 'gradeName')
  String gradeName;

  @JsonKey(name: 'className')
  String className;

  @JsonKey(name: 'rate')
  double rate;

  @JsonKey(name: 'ratio')
  String ratio;

  @JsonKey(name: 'noAnswerCount')
  int noAnswerCount;

  @JsonKey(name: 'finishInfos')
  List<FinishInfos> finishInfos;

  @JsonKey(name: 'studentReports')
  List<StudentReports> studentReports;

  JobReportQuestionDeatilModel(
    this.jobName,
    this.schoolId,
    this.schoolName,
    this.gradeId,
    this.gradeName,
    this.className,
    this.rate,
    this.ratio,
    this.noAnswerCount,
    this.finishInfos,
    this.studentReports,
  );

  factory JobReportQuestionDeatilModel.fromJson(Map<String, dynamic> srcJson) =>
      _$JobReportQuestionDeatilModelFromJson(srcJson);

  Map<String, dynamic> toJson() => _$JobReportQuestionDeatilModelToJson(this);
}

@JsonSerializable()
class FinishInfos extends Object {
  @JsonKey(name: 'title')
  String title;

  @JsonKey(name: 'finishCount')
  int finishCount;

  @JsonKey(name: 'correctRate')
  int correctRate;

  FinishInfos(
    this.title,
    this.finishCount,
    this.correctRate,
  );

  factory FinishInfos.fromJson(Map<String, dynamic> srcJson) => _$FinishInfosFromJson(srcJson);

  Map<String, dynamic> toJson() => _$FinishInfosToJson(this);
}

@JsonSerializable()
class StudentReports extends Object {
  @JsonKey(name: 'studentName')
  String studentName;

  @JsonKey(name: 'pass')
  bool pass;

  @JsonKey(name: 'finishInfos')
  List<FinishInfo> finishInfos;

  StudentReports(
    this.studentName,
    this.pass,
    this.finishInfos,
  );

  factory StudentReports.fromJson(Map<String, dynamic> srcJson) => _$StudentReportsFromJson(srcJson);

  Map<String, dynamic> toJson() => _$StudentReportsToJson(this);
}

@JsonSerializable()
class FinishInfo extends Object {
  @JsonKey(name: 'title')
  String title;

  @JsonKey(name: 'finishCount')
  int finishCount;

  @JsonKey(name: 'correctRate')
  double correctRate;

  FinishInfo(
    this.title,
    this.finishCount,
    this.correctRate,
  );

  factory FinishInfo.fromJson(Map<String, dynamic> srcJson) => _$FinishInfoFromJson(srcJson);

  Map<String, dynamic> toJson() => _$FinishInfoToJson(this);
}
