import 'package:sport/bean/user_info.dart';
import 'package:sport/services/Converter.dart';

class UserFriend {
  int uid;
  String isFriends;
  int isIgnore;
  String groups;
  String createdAt;
  String updatedAt;
  UserInfo socialInfo;

  UserFriend(
      {this.uid,
      this.isFriends,
      this.groups,
      this.createdAt,
      this.updatedAt,
      this.socialInfo});

  UserFriend.fromJson(Map<String, dynamic> json) {
    uid = Converter.toInt(json['uid']);
    isFriends = json['is_friends'];
    isIgnore = Converter.toInt(json['is_ignore']);
    groups = json['groups'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
    socialInfo = json['socialInfo'] != null
        ? new UserInfo.fromJson(json['socialInfo'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['uid'] = this.uid;
    data['is_friends'] = this.isFriends;
    data['groups'] = this.groups;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    if (this.socialInfo != null) {
      data['socialInfo'] = this.socialInfo.toJson();
    }
    return data;
  }
}

class NewFriend {
  int id;
  String name;
  String level;
  String score;
  String isBan;
  String provinceId;
  String cityId;
  String districtId;
  String gender;
  String age;
  String avatar;
  String city;
  NewFriend(
      this.id,
      this.name,
      this.level,
      this.score,
      this.isBan,
      this.provinceId,
      this.cityId,
      this.districtId,
      this.gender,
      this.age,
      this.avatar,
      this.city);
  NewFriend.fromJson(Map<String, dynamic> json) {
    id = Converter.toInt(json['id']);
    name = json['name'];
    level = json['level'];
    score = json['score'];
    isBan = json['is_ban'];
    provinceId = json['province_id'];
    cityId = json['city_id'];
    districtId = json['district_id'];
    gender = json['gender'];
    age = json['age'];
    avatar = json['avatar'];
    city = json['city'];
  }
  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['level'] = this.level;
    data['isBan'] = this.isBan;
    data['provinceId'] = this.provinceId;
    data['cityId'] = this.cityId;
    data['districtId'] = this.districtId;
    data['gender'] = this.gender;
    data['age'] = this.age;
    data['avatar'] = this.avatar;
    data['city'] = this.city;
    return data;
  }
}
