admin
2021-11-27 3465ac6e980f1473e4f42ba3eaafc7815423efec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import 'package:locations/model/user/user_info.dart';
 
class LocationUserModel {
  LocationUserModel(
      {String? id,
      int? targetUid,
      String? targetName,
      String? targetPhone,
      LocationInviteStatus? status,
      LocationUserType? userType,
      UserInfo? userInfo}) {
    _id = id;
    _targetUid = targetUid;
    _targetName = targetName;
    _targetPhone = targetPhone;
    _status = status;
    _userType = userType;
    _userInfo = userInfo;
  }
 
  LocationUserModel.fromJson(dynamic json) {
    _id = json['id'];
    _targetUid = json['targetUid'];
    _targetName = json['targetName'];
    _targetPhone = json['targetPhone'];
    switch (json['status']) {
      case "sentInvite":
        _status = LocationInviteStatus.sentInvite;
        break;
      case "agree":
        _status = LocationInviteStatus.agree;
        break;
      case "reject":
        _status = LocationInviteStatus.reject;
        break;
    }
 
    switch (json['userType']) {
      case "son":
        _userType = LocationUserType.son;
        break;
      case "daughter":
        _userType = LocationUserType.daughter;
        break;
      case "husband":
        _userType = LocationUserType.husband;
        break;
      case "wife":
        _userType = LocationUserType.wife;
        break;
      case "father":
        _userType = LocationUserType.father;
        break;
      case "mother":
        _userType = LocationUserType.mother;
        break;
      case "other":
        _userType = LocationUserType.other;
        break;
    }
 
    _userInfo = UserInfo.fromJson(json['userInfo']);
  }
 
  String? _id;
  int? _targetUid;
  String? _targetName;
  String? _targetPhone;
  LocationInviteStatus? _status;
  LocationUserType? _userType;
  UserInfo? _userInfo;
 
  String? get id => _id;
 
  int? get targetUid => _targetUid;
 
  String? get targetName => _targetName;
 
  String? get targetPhone => _targetPhone;
 
  UserInfo? get userInfo => _userInfo;
 
  LocationInviteStatus? get status => _status;
 
  LocationUserType? get userType => _userType;
 
  Map<String?, dynamic> toJson() {
    final map = <String?, dynamic>{};
    map['id'] = _id;
    map['targetUid'] = _targetUid;
    map['targetName'] = _targetName;
    map['targetPhone'] = _targetPhone;
    map['status'] = _status;
    map['userType'] = _userType;
    map['userInfo'] = _userInfo;
    return map;
  }
}
 
enum LocationUserType { father, mother, husband, wife, daughter, son, other }
 
enum LocationInviteStatus { sentInvite, agree, reject }