/*
 * @Author: wangyang 1147192855@qq.com
 * @Date: 2022-07-22 15:19:54
 * @LastEditors: wangyang 1147192855@qq.com
 * @LastEditTime: 2022-07-27 12:26:15
 * @FilePath: \marking_app\lib\common\model\marking\marking_text_question_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/marking_text_question_tab.dart';

part 'marking_text_question_tab_params.g.dart';

@JsonSerializable(includeIfNull: false)
class MarkingTextQuestionTabParams extends Object {
  @JsonKey(name: 'markingUserId')
  int markingUserId;

  @JsonKey(name: 'MarkingUserDetailId')
  int? markingUserDetailId;

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

  MarkingTextQuestionTabParams({
    required this.markingUserId,
    required this.questionNum,
    this.markingUserDetailId,
  });

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

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

  MarkingTextQuestionTabParams setQuestionNum({required MarkingTextQuestionTab tab, String? locaQuestionNum}) {
    this.questionNum = tab.questionNum;
    if (locaQuestionNum != null && questionNum != locaQuestionNum) {
      this.markingUserDetailId = 0;
    }
    return this;
  }
}
