import 'package:json_annotation/json_annotation.dart';
import 'UserInfo.dart';
import 'GameInfo.dart';
import 'HouseInfo.dart';

part 'PlayerInfo.g.dart';

@JsonSerializable()
class PlayerInfo {
  PlayerInfo(
      this.id, this.houseId, this.userId, this.statusFlag, this.userInfo,this.bonus,this.gameInfo,this.houseInfo,this.rank,this.houseRank,this.video,this.platinum,this.gold,this.silver,this.bronze,this.medal,this.liveTime,this.score,this.ranking,this.beginTime,this.endTime,this.dataError,this.killNumber,this.needkill);
  int id;
  int houseId; //房间id
  int userId; //用户id
  int statusFlag; //状态 0加入 1准备 2开始 3结束 4结算 6未比赛 9.解析失败 7.超时 
  UserInfo userInfo;
  num bonus;//奖金
  GameInfo gameInfo;
  HouseInfo houseInfo;
  int rank;//名次
  int houseRank;//房间比赛名次
  String video;//视频地址
  int platinum; //铂金
  int gold;//金牌
  int  silver;//银牌
  int bronze;//铜牌
  String medal;//奖牌
  num liveTime;//存活时间
  num score;//评分
  int ranking;//是否吃鸡 1吃鸡
  int beginTime;//开始比赛时间
  int endTime;//结束比赛时间
  bool dataError;//数据异常
  int killNumber;//
  int needkill;
  
  factory PlayerInfo.fromJson(Map<String, dynamic> json) =>
      _$PlayerInfoFromJson(json);

  Map<String, dynamic> toJson() => _$PlayerInfoToJson(this);
  // 命名构造函数
  PlayerInfo.empty();

  String getPlatinum() {
    return this.platinum.toString();
  }
   String getGold() {
    return this.gold.toString();
  }
   String getSilver() {
    return this.silver.toString();
  }
   String getBronze() {
    return this.bronze.toString();
  }

  @override
  String toString() {
    return _$PlayerInfoToJson(this).toString();
  }
}
