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

class GameInfoData {
  int id;
  String name;
  List<String> tags;
  String cover;
  String coverHorizontal;
  String coverVertical;
  String introduceVideo;
  String introduceVideoCover;
  String introduce;
  List<String> introduceImages;
  double fileSize;
  String publishDate;
  String developCompany;
  int likeCount;
  int userCount;
  String version;
  String downloadUrl;
  int subjectId;
  String playTime;
  int durationTotal;
  GamesSum sum;
  bool isLike;
  int fileSizeByte;
  String packageNameIos,packageNameAndroid;
  Rank rank;
  bool isLocal;


  GameInfoData({
    this.id,
    this.name,
    this.tags,
    this.cover,
    this.coverHorizontal,
    this.coverVertical,
    this.introduceVideo,
    this.introduceVideoCover,
    this.introduce,
    this.introduceImages,
    this.fileSize,
    this.publishDate,
    this.developCompany,
    this.likeCount,
    this.userCount,
    this.version,
    this.downloadUrl,
    this.subjectId,
    this.isLike,
    this.fileSizeByte,
    this.packageNameIos,
    this.packageNameAndroid,
    this.isLocal,
      this.playTime,
        this.durationTotal,});

  GameInfoData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    tags = json['tags'].cast<String>();
    cover = json['cover'];
    coverHorizontal = json['cover_horizontal'];
    coverVertical = json['cover_vertical'];
    introduceVideo = json['introduce_video'];
    introduceVideoCover = json['introduce_video_cover'];
    introduce = json['introduce'];
    introduceImages = json['introduce_images'].cast<String>();
    fileSize = Converter.toDouble(json['file_size']);
    publishDate = json['publish_date'];
    developCompany = json['develop_company'];
    likeCount = json['like_count'];
    userCount = json['user_count'];
    version = json['version'];
    downloadUrl = json['download_url'];
    subjectId = json['subject_id'];
    playTime = json['play_time'];
    durationTotal = json['duration_total'];
    sum = json['sum'] != null ? new GamesSum.fromJson(json['sum']) : null;
    isLike = json['is_like'];
    fileSizeByte = json['file_size_byte'];
    packageNameIos = json['package_name_ios'];
    packageNameAndroid = json['package_name_android'];
    rank = json['rank'] != null ? new Rank.fromJson(json['rank']) : null;
    isLocal = json['isLocal'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['tags'] = this.tags;
    data['cover'] = this.cover;
    data['cover_horizontal'] = this.coverHorizontal;
    data['cover_vertical'] = this.coverVertical;
    data['cover_vertical'] = this.coverVertical;
    data['introduce_video'] = this.introduceVideo;
    data['introduce_video_cover'] = this.introduceVideoCover;
    data['introduce'] = this.introduce;
    data['introduce_images'] = this.introduceImages;
    data['file_size'] = this.fileSize;
    data['publish_date'] = this.publishDate;
    data['develop_company'] = this.developCompany;
    data['like_count'] = this.likeCount;
    data['user_count'] = this.userCount;
    data['version'] = this.version;
    data['download_url'] = this.downloadUrl;
    data['subject_id'] = this.subjectId;
    data['play_time'] = this.playTime;
    data['duration_total'] = this.durationTotal;
    data['is_like'] = this.isLike;
    data['file_size_byte'] = this.fileSizeByte;
    data['isLocal'] = this.isLocal;
    data['package_name_ios'] = this.packageNameIos;
    data['package_name_android'] = this.packageNameAndroid;
    if (this.rank != null) {
      data['rank'] = this.rank.toJson();
    }
    return data;
  }
}
