Untitled

 avatar
unknown
dart
3 years ago
3.6 kB
2
Indexable
class JobInfoModel {
  Data data;
  int timeoutMiliseconds;

  JobInfoModel({this.data, this.timeoutMiliseconds});

  JobInfoModel.fromJson(Map<String, dynamic> json) {
    data = json['data'] != null ? Data.fromJson(json['data']) : null;
    timeoutMiliseconds = json['TimeoutMiliseconds'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data.toJson();
    }
    data['TimeoutMiliseconds'] = timeoutMiliseconds;
    return data;
  }
}

class Data {
  String deviceID;
  RequestInfo requestInfo;
  UserInfo userInfo;

  Data({this.deviceID, this.requestInfo, this.userInfo});

  Data.fromJson(Map<String, dynamic> json) {
    deviceID = json['DeviceID'];
    requestInfo = json['RequestInfo'] != null
        ? RequestInfo.fromJson(json['RequestInfo'])
        : null;
    userInfo = json['UserInfo'] != null
        ? UserInfo.fromJson(json['UserInfo'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = Map<String, dynamic>();
    data['DeviceID'] = deviceID;
    if (requestInfo != null) {
      data['RequestInfo'] = requestInfo.toJson();
    }
    if (userInfo != null) {
      data['UserInfo'] = userInfo.toJson();
    }
    return data;
  }
}

class RequestInfo {
  String userID;
  double beginLat;
  double beginLng;
  double endLat;
  double endLng;
  String beginCity;
  String endCity;
  int routeIndex;
  int payMethods;

  RequestInfo(
      {this.userID,
      this.beginLat,
      this.beginLng,
      this.endLat,
      this.endLng,
      this.beginCity,
      this.endCity,
      this.routeIndex,
      this.payMethods});

  RequestInfo.fromJson(Map<String, dynamic> json) {
    userID = json['UserID'];
    beginLat = json['BeginLat'];
    beginLng = json['BeginLng'];
    endLat = json['EndLat'];
    endLng = json['EndLng'];
    beginCity = json['BeginCity'];
    endCity = json['EndCity'];
    routeIndex = json['RouteIndex'];
    payMethods = json['PayMethods'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = Map<String, dynamic>();
    data['UserID'] = userID;
    data['BeginLat'] = beginLat;
    data['BeginLng'] = beginLng;
    data['EndLat'] = endLat;
    data['EndLng'] = endLng;
    data['BeginCity'] = beginCity;
    data['EndCity'] = endCity;
    data['RouteIndex'] = routeIndex;
    data['PayMethods'] = payMethods;
    return data;
  }
}

class UserInfo {
  String sId;
  String name;
  String surname;
  String phone;
  String email;
  String saveTime;
  String password;
  String profilePicturePath;
  String isVerified;

  UserInfo(
      {this.sId,
      this.name,
      this.surname,
      this.phone,
      this.email,
      this.saveTime,
      this.password,
      this.profilePicturePath,
      this.isVerified});

  UserInfo.fromJson(Map<String, dynamic> json) {
    sId = json['_id'];
    name = json['Name'];
    surname = json['Surname'];
    phone = json['Phone'];
    email = json['Email'];
    saveTime = json['SaveTime'];
    password = json['Password'];
    profilePicturePath = json['ProfilePicturePath'];
    isVerified = json['IsVerified'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = Map<String, dynamic>();
    data['_id'] = sId;
    data['Name'] = name;
    data['Surname'] = surname;
    data['Phone'] = phone;
    data['Email'] = email;
    data['SaveTime'] = saveTime;
    data['Password'] = password;
    data['ProfilePicturePath'] = profilePicturePath;
    data['IsVerified'] = isVerified;
    return data;
  }
}