/*
 * @Author: WuXiangNan
 * @Date: 2021-02-21 10:06:47
 * @LastEditTime: 2021-04-28 11:29:30
 * @LastEditors: WuXiangNan
 * @Description: 考勤打卡状态数据
 */
import 'package:attendance_package/src/models/response_model/clock_status/clock_way_content_model.dart';
import 'package:attendance_package/src/models/response_model/clock_status/rules_model.dart';

import './clock_way_result_model.dart';
import './current_clock_status_vos_model.dart';

class ClockStatusDataModel {
  String? normalOrLegWork;
  ClockWayResultModel? clockWayResult;
  String? clockStatusCode;
  String? clockStatusName;
  List<CurrentClockStatusVosModel>? currentClockStatusVos;
  int? shiftType;
  String? groupIdentification;
  String? legWorkSetting;
  bool? workDay;
  List<RulesModel>? rules;
  ClockWayContentModel? clockWayContent;
  bool? success;
  String? code;

  ClockStatusDataModel({
    this.normalOrLegWork,
    this.clockWayResult,
    this.clockStatusCode,
    this.clockStatusName,
    this.currentClockStatusVos,
    this.shiftType,
    this.groupIdentification,
    this.legWorkSetting,
    this.workDay,
    this.clockWayContent,
    this.rules,
    this.success,
    this.code,
  });

  ClockStatusDataModel.fromJson(json) {
    Map<String, dynamic> map = Map.from(json ?? {});
    normalOrLegWork = map['normalOrLegWork'];
    clockWayResult = ClockWayResultModel.fromJson(map['clockWayResult'] ?? {});
    clockStatusCode = map['clockStatusCode'];
    clockStatusName = map['clockStatusName'];
    currentClockStatusVos = List<CurrentClockStatusVosModel>.from(
        (map["currentClockStatusVos"] ?? [])
            .map((x) => CurrentClockStatusVosModel.fromJson(x)));
    shiftType = map['shiftType'];
    groupIdentification = map['groupIdentification'];
    legWorkSetting = map['legWorkSetting'];
    workDay = map['workDay'];
    rules = List<RulesModel>.from(
        (map["rules"] ?? []).map((x) => RulesModel.fromJson(x)));
    clockWayContent =
        ClockWayContentModel.fromJson(map['clockWayContent'] ?? {});
    success = map['success'];
    code = map['code'];
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = Map<String, dynamic>();

    json['normalOrLegWork'] = this.normalOrLegWork;
    json['clockWayResult'] = this.clockWayResult!.toJson();
    json['clockStatusCode'] = this.clockStatusCode;
    json['clockStatusName'] = this.clockStatusName;
    json['currentClockStatusVos'] = List<dynamic>.from(
        (currentClockStatusVos ?? []).map((x) => x.toJson()));
    json['shiftType'] = this.shiftType;
    json['groupIdentification'] = this.groupIdentification;
    json['legWorkSetting'] = this.legWorkSetting;
    json['workDay'] = this.workDay;
    json['rules'] = List<dynamic>.from((rules ?? []).map((x) => x.toJson()));
    json['clockWayContent'] = this.clockWayContent!.toJson();
    json['success'] = this.success;
    json['code'] = this.code;

    return json;
  }
}
