/*
 * @Author: wangyang 1147192855@qq.com
 * @Date: 2022-07-18 12:58:28
 * @LastEditors: wangyang 1147192855@qq.com
 * @LastEditTime: 2022-07-19 16:27:05
 * @FilePath: \marking_app\lib\common\model\marking\marking_list_params.dart
 * @Description: 阅卷列表请求参数类
 */
import 'package:json_annotation/json_annotation.dart';
import 'package:marking_app/common/model/common/base_page.dart';
import 'package:marking_app/common/model/enum/marking_list_type.dart';

part 'marking_list_params.g.dart';

@JsonSerializable()
class MarkingListParams extends BasePage {
  @JsonKey(name: 'isFinish')
  bool isFinish;

  // 阅卷类型
  @JsonKey(name: 'PageType')
  int pageType;

  String? startTime;
  String? endTime;

  int? markingType; // 1 作业 2考试

  MarkingListParams({
    required this.isFinish,
    required this.pageType,
    required page,
    required limit,
    this.markingType,
    this.startTime,
    this.endTime,
  }) : super(page, limit) {
    this.markingType ??= 1;
  }

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

  @override
  Map<String, dynamic> toJson() => _$MarkingListParamsToJson(this);

  setPagetype(MarkingListType typeEnum) {
    this.pageType = typeEnum.index;
  }

  MarkingListType getPagetype() {
    return MarkingListType.values[pageType];
  }
}
