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;
  }
}
