/*
 * @Author: WuXiangNan
 * @Date: 2021-02-21 11:07:25
 * @LastEditTime: 2021-04-01 11:37:18
 * @LastEditors: WuXiangNan
 * @Description: 考勤规则
 */
import './rule_time_model.dart';

class RuleModel {
  String? shiftType;
  String? groupName;
  List<RuleTimeModel>? ruleTime;
  List<RuleTimeModel>? rule;
  String? legWorkSetting;
  List<String>? location;

  RuleModel({
    this.shiftType,
    this.groupName,
    this.ruleTime,
    this.rule,
    this.legWorkSetting,
    this.location,
  });

  RuleModel.fromJson(json) {
    Map<String, dynamic> map = Map.from(json ?? {});

    shiftType = map['shiftType'];
    groupName = map['groupName'];
    ruleTime = List<RuleTimeModel>.from(
        (map['ruleTime'] ?? []).map((e) => RuleTimeModel.fromJson(e)));
    rule = List<RuleTimeModel>.from(
        (map['rule'] ?? []).map((e) => RuleTimeModel.fromJson(e)));
    legWorkSetting = map['legWorkSetting'];
    location = List<String>.from(map['location']);
  }

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

    json['shiftType'] = this.shiftType;
    json['groupName'] = this.groupName;
    json['ruleTime'] =
        List<dynamic>.from((ruleTime ?? []).map((e) => e.toJson()));
    json['rule'] = List<dynamic>.from((rule ?? []).map((e) => e.toJson()));
    json['location'] = List<dynamic>.from(location ?? []);
    json['legWorkSetting'] = this.legWorkSetting;

    return json;
  }
}
