import 'package:sport/bean/rank_game_info.dart';
import 'package:sport/bean/user.dart';

//class AchieveDetailInfo {
//  int result;
//  int code;
//  String msg;
//  AchieveDetailInfoData data;
//
//  AchieveDetailInfo({this.result, this.code, this.msg, this.data});
//
//  AchieveDetailInfo.fromJson(Map<String, dynamic> json) {
//    result = json['result'];
//    code = json['code'];
//    msg = json['msg'];
//    data = json['data'] != null ? new AchieveDetailInfoData.fromJson(json['data']) : null;
//  }
//
//  Map<String, dynamic> toJson() {
//    final Map<String, dynamic> data = new Map<String, dynamic>();
//    data['result'] = this.result;
//    data['code'] = this.code;
//    data['msg'] = this.msg;
//    if (this.data != null) {
//      data['data'] = this.data.toJson();
//    }
//    return data;
//  }
//}
//
//class AchieveDetailInfoData {
//  int id;
//  String name;
//  String logo;
//  int conditionDuration;
//  int sort;
//  int seriesId;
//  int rewardScore;
//  List<Achievement> relateAchivements;
//  String position;
//  String createdAt;
//
//  AchieveDetailInfoData(
//      {this.id,
//        this.name,
//        this.logo,
//        this.conditionDuration,
//        this.sort,
//        this.seriesId,
//        this.rewardScore,
//        this.relateAchivements,
//        this.position,
//        this.createdAt});
//
//  AchieveDetailInfoData.fromJson(Map<String, dynamic> json) {
//    id = json['id'];
//    name = json['name'];
//    logo = json['logo'];
//    conditionDuration = json['condition_duration'];
//    sort = json['sort'];
//    seriesId = json['series_id'];
//    rewardScore = json['reward_score'];
//    if (json['relate_achivements'] != null) {
//      relateAchivements = new List<Achievement>();
//      json['relate_achivements'].forEach((v) {
//        relateAchivements.add(new Achievement.fromJson(v));
//      });
//    }
//    position = json['position'];
//    createdAt = json['created_at'];
//  }
//
//  Map<String, dynamic> toJson() {
//    final Map<String, dynamic> data = new Map<String, dynamic>();
//    data['id'] = this.id;
//    data['name'] = this.name;
//    data['logo'] = this.logo;
//    data['condition_duration'] = this.conditionDuration;
//    data['sort'] = this.sort;
//    data['series_id'] = this.seriesId;
//    data['reward_score'] = this.rewardScore;
//    if (this.relateAchivements != null) {
//      data['relate_achivements'] =
//          this.relateAchivements.map((v) => v.toJson()).toList();
//    }
//    data['position'] = this.position;
//    data['created_at'] = this.createdAt;
//    return data;
//  }
//}


class AchieveDetailInfo {
  int result;
  int code;
  String msg;
  AchieveDetailInfoData data;

  AchieveDetailInfo({this.result, this.code, this.msg, this.data});

  AchieveDetailInfo.fromJson(Map<String, dynamic> json) {
    result = json['result'];
    code = json['code'];
    msg = json['msg'];
    data = json['data'] != null ? new AchieveDetailInfoData.fromJson(json['data']) : null;
  }

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

class AchieveDetailInfoData {
  int id;
  int seriesId;
  String logo;
  String name;
  int rewardExp;
  int rewardScore;
  int conditionCount;
  String createdAt;
  int nextRewardExp;
  int nextRewardScore;
  int nextConditionCount;
  int conditionProgress;
  List<Achievement> relateAchievements;
  String conditionDetail;
  String conditionMeasure;

  AchieveDetailInfoData(
      {this.id,
        this.seriesId,
        this.logo,
        this.name,
        this.rewardExp,
        this.rewardScore,
        this.conditionCount,
        this.createdAt,
        this.nextRewardExp,
        this.nextRewardScore,
        this.nextConditionCount,
        this.conditionProgress,
        this.relateAchievements,
        this.conditionDetail,
        this.conditionMeasure});

  AchieveDetailInfoData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    seriesId = json['series_id'];
    logo = json['logo'];
    name = json['name'];
    rewardExp = json['reward_exp'];
    rewardScore = json['reward_score'];
    conditionCount = json['condition_count'];
    createdAt = json['created_at'];
    nextRewardExp = json['next_reward_exp'];
    nextRewardScore = json['next_reward_score'];
    nextConditionCount = json['next_condition_count'];
    conditionProgress = json['condition_progress'];
    if (json['relate_achievements'] != null) {
      relateAchievements = new List<Achievement>();
      json['relate_achievements'].forEach((v) {
        relateAchievements.add(new Achievement.fromJson(v));
      });
    }
    conditionDetail = json['condition_detail'];
    conditionMeasure = json['condition_measure'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['series_id'] = this.seriesId;
    data['logo'] = this.logo;
    data['name'] = this.name;
    data['reward_exp'] = this.rewardExp;
    data['reward_score'] = this.rewardScore;
    data['condition_count'] = this.conditionCount;
    data['created_at'] = this.createdAt;
    data['next_reward_exp'] = this.nextRewardExp;
    data['next_reward_score'] = this.nextRewardScore;
    data['next_condition_count'] = this.nextConditionCount;
    data['condition_progress'] = this.conditionProgress;
    if (this.relateAchievements != null) {
      data['relate_achievements'] =
          this.relateAchievements.map((v) => v.toJson()).toList();
    }
    data['condition_detail'] = this.conditionDetail;
    data['condition_measure'] = this.conditionMeasure;
    return data;
  }
}

class RelateAchievements {
  int id;
  int seriesId;
  String logo;
  String name;
  int rewardExp;
  int rewardScore;
  int conditionCount;
  Null createdAt;

  RelateAchievements(
      {this.id,
        this.seriesId,
        this.logo,
        this.name,
        this.rewardExp,
        this.rewardScore,
        this.conditionCount,
        this.createdAt});

  RelateAchievements.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    seriesId = json['series_id'];
    logo = json['logo'];
    name = json['name'];
    rewardExp = json['reward_exp'];
    rewardScore = json['reward_score'];
    conditionCount = json['condition_count'];
    createdAt = json['created_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['series_id'] = this.seriesId;
    data['logo'] = this.logo;
    data['name'] = this.name;
    data['reward_exp'] = this.rewardExp;
    data['reward_score'] = this.rewardScore;
    data['condition_count'] = this.conditionCount;
    data['created_at'] = this.createdAt;
    return data;
  }
}