// {"id":"","name":"联系人","loginName":"登录名称","oldLoginName":"登录名称","mobile":"联系电话","password":"密码","newPassword":"密码","office":{"code":"充一信用代码","name":"单位名称","address":"充一信用代码","type":"1,2","area":{"id":"归属单位"},"officeDtoList":[{"deviceTypeId":"40e5b12df76941c494e3e20c74d20808","unitType":"1,2"}]},"userDtoList":[{"roleId":"角色 id","deviceTypeId":"设备 id"}],"userRoleList":[{"id":""}]}
// {"id":"b4e742b1043c4e128b8ed38de33d29d8","name":"老刘刘","loginName":"laoliuliu","oldLoginName":"laoliuliu","mobile":"15201506337.","password":null,"newPassword":"","userDtoList":[{"roleId":"f801011eb2c1481892dba5bc15023733","deviceTypeId":"99648d6e69c9463d823fac8b7888a240"},{"roleId":"77584ba03b4545fba9d23fd670b66c10","deviceTypeId":"99648d6e69c9463d823fac8b7888a240"},{"roleId":"77584ba03b4545fba9d23fd670b66c10","deviceTypeId":"ab84fc867cc44db2a02a273cb825d843"}],"userRoleList":[{"id":"90280a818b2f40cda768a291cf0370a9"},{"id":"f801011eb2c1481892dba5bc15023733"},{"id":"77584ba03b4545fba9d23fd670b66c10"}]}
class UnitRigisterBo {
  UnitRigisterBo({
    this.id,
    this.name,
    this.loginName,
    this.oldLoginName,
    this.mobile,
    this.password,
    this.newPassword,
    this.office,
    this.userDtoList,
    this.userRoleList,
  });

  UnitRigisterBo.fromJson(dynamic json) {
    id = json['id'];
    name = json['name'];
    loginName = json['loginName'];
    oldLoginName = json['oldLoginName'];
    mobile = json['mobile'];
    password = json['password'];
    newPassword = json['newPassword'];
    office = json['office'] != null ? Offices.fromJson(json['office']) : null;
    if (json['userDtoList'] != null) {
      userDtoList = [];
      json['userDtoList'].forEach((v) {
        userDtoList?.add(UserDtoList.fromJson(v));
      });
    }
    if (json['userRoleList'] != null) {
      userRoleList = [];
      json['userRoleList'].forEach((v) {
        userRoleList?.add(UserRoleList.fromJson(v));
      });
    }
  }

  String? id;
  String? name;
  String? loginName;
  String? oldLoginName;
  String? mobile;
  String? password;
  String? newPassword;
  Offices? office;
  List<UserDtoList>? userDtoList;
  List<UserRoleList>? userRoleList;

  UnitRigisterBo copyWith({
    String? id,
    String? name,
    String? loginName,
    String? oldLoginName,
    String? mobile,
    String? password,
    String? newPassword,
    Offices? office,
    List<UserDtoList>? userDtoList,
    List<UserRoleList>? userRoleList,
  }) =>
      UnitRigisterBo(
        id: id ?? this.id,
        name: name ?? this.name,
        loginName: loginName ?? this.loginName,
        oldLoginName: oldLoginName ?? this.oldLoginName,
        mobile: mobile ?? this.mobile,
        password: password ?? this.password,
        newPassword: newPassword ?? this.newPassword,
        office: office ?? this.office,
        userDtoList: userDtoList ?? this.userDtoList,
        userRoleList: userRoleList ?? this.userRoleList,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    map['name'] = name;
    map['loginName'] = loginName;
    map['oldLoginName'] = oldLoginName;
    map['mobile'] = mobile;
    map['password'] = password;
    map['newPassword'] = newPassword;
    if (office != null) {
      map['office'] = office?.toJson();
    }
    if (userDtoList != null) {
      map['userDtoList'] = userDtoList?.map((v) => v.toJson()).toList();
    }
    if (userRoleList != null) {
      map['userRoleList'] = userRoleList?.map((v) => v.toJson()).toList();
    }
    return map;
  }
}

class UserRoleList {
  UserRoleList({
    this.id,
  });

  UserRoleList.fromJson(dynamic json) {
    id = json['id'];
  }

  String? id;

  UserRoleList copyWith({
    String? id,
  }) =>
      UserRoleList(
        id: id ?? this.id,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    return map;
  }
}

class UserDtoList {
  UserDtoList({
    this.id,
    this.roleId,
    this.deviceTypeId,
  });

  UserDtoList.fromJson(dynamic json) {
    id = json['id'];
    roleId = json['roleId'];
    deviceTypeId = json['deviceTypeId'];
  }

  String? id;
  String? roleId;
  String? deviceTypeId;

  UserDtoList copyWith({
    String? id,
    String? roleId,
    String? deviceTypeId,
  }) =>
      UserDtoList(
        id: id ?? this.id,
        roleId: roleId ?? this.roleId,
        deviceTypeId: deviceTypeId ?? this.deviceTypeId,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    map['roleId'] = roleId;
    map['deviceTypeId'] = deviceTypeId;
    return map;
  }
}

class Offices {
  Offices({
    this.code,
    this.name,
    this.address,
    this.type,
    this.area,
    this.officeDtoList,
  });

  Offices.fromJson(dynamic json) {
    code = json['code'];
    name = json['name'];
    address = json['address'];
    type = json['type'];
    area = json['area'] != null ? Areas.fromJson(json['area']) : null;
    if (json['officeDtoList'] != null) {
      officeDtoList = [];
      json['officeDtoList'].forEach((v) {
        officeDtoList?.add(OfficeDtoList.fromJson(v));
      });
    }
  }

  String? code;
  String? name;
  String? address;
  String? type;
  Areas? area;
  List<OfficeDtoList>? officeDtoList;

  Offices copyWith({
    String? code,
    String? name,
    String? address,
    String? type,
    Areas? area,
    List<OfficeDtoList>? officeDtoList,
  }) =>
      Offices(
        code: code ?? this.code,
        name: name ?? this.name,
        address: address ?? this.address,
        type: type ?? this.type,
        area: area ?? this.area,
        officeDtoList: officeDtoList ?? this.officeDtoList,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['code'] = code;
    map['name'] = name;
    map['address'] = address;
    map['type'] = type;
    if (area != null) {
      map['area'] = area?.toJson();
    }
    if (officeDtoList != null) {
      map['officeDtoList'] = officeDtoList?.map((v) => v.toJson()).toList();
    }
    return map;
  }
}

class OfficeDtoList {
  OfficeDtoList({
    this.deviceTypeId,
    this.unitType,
    this.id,
  });

  OfficeDtoList.fromJson(dynamic json) {
    deviceTypeId = json['deviceTypeId'];
    unitType = json['unitType'];
    id = json['id'];
  }

  String? deviceTypeId;
  String? unitType;
  String? id;

  OfficeDtoList copyWith({
    String? deviceTypeId,
    String? unitType,
    String? id,
  }) =>
      OfficeDtoList(
        deviceTypeId: deviceTypeId ?? this.deviceTypeId,
        unitType: unitType ?? this.unitType,
        id: id ?? this.id,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['deviceTypeId'] = deviceTypeId;
    map['unitType'] = unitType;
    map['id'] = id;
    return map;
  }
}

class Areas {
  Areas({
    this.id,
  });

  Areas.fromJson(dynamic json) {
    id = json['id'];
  }

  String? id;

  Areas copyWith({
    String? id,
  }) =>
      Areas(
        id: id ?? this.id,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    return map;
  }
}
