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

class PostUser {
  String id;
  String name;
  String level;
  String score;
  String isBan;
  String provinceId;
  String cityId;
  String districtId;
  int gender;
  int age;
  String avatar;

  PostUser(
      {this.id,
        this.name,
        this.level,
        this.score,
        this.isBan,
        this.provinceId,
        this.cityId,
        this.districtId,
        this.gender,
        this.age,
        this.avatar});

  PostUser.fromJson(Map<String, dynamic> json) {
    id = 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 = Converter.toInt(json['gender']);
    age =  Converter.toInt(json['age']);
    avatar = json['avatar'];
  }

  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['score'] = this.score;
    data['is_ban'] = this.isBan;
    data['province_id'] = this.provinceId;
    data['city_id'] = this.cityId;
    data['district_id'] = this.districtId;
    data['gender'] = this.gender;
    data['age'] = this.age;
    data['avatar'] = this.avatar;
    return data;
  }
}