import 'package:json_annotation/json_annotation.dart';

part 'annotated_class.g.dart';


@JsonSerializable()
class AnnotatedClass extends Object {

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

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

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

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

  @JsonKey(name: 'finishTime')
  String? finishTime;

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

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

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

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

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

  @JsonKey(name: 'students')
  List<AnnotatedStudents> students;

  @JsonKey(name: 'homeworkFavs')
  List<HomeworkFavs> homeworkFavs;

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

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

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

  @JsonKey(name: 'commitStudentCount')
  int? commitStudentCount;

  @JsonKey(name: 'noCommitStudentCount')
  int? noCommitStudentCount;

  @JsonKey(name: 'commitStudent')
  List<AnnotatedStudents>? commitStudent;

  @JsonKey(name: 'noCommitStudent')
  List<AnnotatedStudents>? noCommitStudent;

  AnnotatedClass(this.schoolName,this.grade,this.classId,this.className,this.finishTime,this.questionCount,this.answerCount,this.answerRate,this.unAnnotateCount,this.annotateRate,this.students,this.homeworkFavs,this.kgtCorrectRate,this.zgtCorrectRate,this.correctRate,this.commitStudentCount,this.noCommitStudentCount,this.commitStudent,this.noCommitStudent){
    commitStudent = [];
    noCommitStudent = [];
    commitStudent = students.where((w) => w.state != 0).toList();
    noCommitStudent = students.where((w) => w.state == 0).toList();
  }

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

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

}


@JsonSerializable()
class AnnotatedStudents extends Object {

  @JsonKey(name: 'id')
  String? id;

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

  @JsonKey(name: 'homeworkId')
  String? homeworkId;

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

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

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

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

  AnnotatedStudents(this.id,this.isDeleted,this.homeworkId,this.classId,this.studentId,this.studentName,this.state,);

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

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

}


@JsonSerializable()
class HomeworkFavs extends Object {

  @JsonKey(name: 'id')
  String? id;

  @JsonKey(name: 'homeworkId')
  String? homeworkId;

  @JsonKey(name: 'homeworkName')
  String? homeworkName;

  @JsonKey(name: 'grade')
  int? grade;

  @JsonKey(name: 'subject')
  int? subject;

  @JsonKey(name: 'classId')
  String? classId;

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

  @JsonKey(name: 'studentId')
  int? studentId;

  @JsonKey(name: 'studentName')
  String? studentName;

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

  @JsonKey(name: 'questionNo')
  String? questionNo;

  @JsonKey(name: 'subjectiveAnswer')
  String? subjectiveAnswer;

  @JsonKey(name: 'zgtAnswer')
  String? zgtAnswer;

  HomeworkFavs(this.id,this.homeworkId,this.homeworkName,this.grade,this.subject,this.classId,this.className,this.studentId,this.studentName,this.templateId,this.questionNo,this.subjectiveAnswer,this.zgtAnswer);

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

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

}


