/*
 * @Author: wangyang 1147192855@qq.com
 * @Date: 2022-07-22 15:32:18
 * @LastEditors: wangyang 1147192855@qq.com
 * @LastEditTime: 2022-07-22 15:36:53
 * @FilePath: \marking_app\lib\common\model\marking\submit_exam_params.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:json_annotation/json_annotation.dart';
import 'package:marking_app/common/model/marking/submit_exam_abnormal_params.dart';
import 'package:marking_app/common/model/marking/submit_exam_small_params.dart';

part 'submit_exam_params.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class SubmitExamParams extends Object {
  // 任务ID
  @JsonKey(name: 'markingUserId')
  int markingUserId;

  // 当前试题ID
  @JsonKey(name: 'markingUserDetailId')
  int markingUserDetailId;

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

  // 是否异常
  @JsonKey(name: 'isException')
  bool isException;

  // 得分
  @JsonKey(name: 'score')
  double? score;

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

  // 试题
  @JsonKey(name: 'subQuestionDetailList')
  List<SubmitExamSmallParams>? subQuestionDetailList;

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

  @JsonKey(name: 'isExcess')
  bool? isExcess;

  @JsonKey(name: 'excessContinue')
  bool? excessContinue;

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

  // @JsonKey(name: 'errorRecord', fromJson: SubmitExamAbnormalParams.fromJson, includeIfNull: false)
  // SubmitExamAbnormalParams? errorRecord;

  SubmitExamParams(
    this.markingUserId,
    this.markingUserDetailId, {
    this.score,
    this.subQuestionDetailList,
    this.isException = false,
    this.isReview = false,
    this.commentImageUrl,
    this.questionNum,
    this.isExcess,
    this.excessContinue = true,
    this.pageType,
    // this.errorRecord,
  });

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

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