class ShopIndex {
  Shop shop;
  List<Items> items;
  ShopUser user;

  ShopIndex({this.shop, this.items, this.user});

  ShopIndex.fromJson(Map<String, dynamic> json) {
    print(json);
    shop = json['shop'] != null ? new Shop.fromJson(json['shop']) : null;
    if (json['items'] != null) {
      items = new List<Items>();
      json['items'].forEach((v) {
        items.add(new Items.fromJson(v));
      });
    }
    user = json['user'] != null ? new ShopUser.fromJson(json['user']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.shop != null) {
      data['shop'] = this.shop.toJson();
    }
    if (this.items != null) {
      data['items'] = this.items.map((v) => v.toJson()).toList();
    }
    if (this.user != null) {
      data['user'] = this.user.toJson();
    }
    return data;
  }
}

class Shop {
  int id;
  int gameId;
  String name;
  String type;

  Shop({this.id, this.gameId, this.name, this.type});

  Shop.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    gameId = json['game_id'];
    name = json['name'];
    type = json['type'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['game_id'] = this.gameId;
    data['name'] = this.name;
    data['type'] = this.type;
    return data;
  }
}

class Items {
  int id;
  int shopId;
  int gameId;
  String name;
  String logo;
  int price;
  String detail;
  int valid;

  Items(
      {this.id,
        this.shopId,
        this.gameId,
        this.name,
        this.logo,
        this.price,
        this.detail,
        this.valid});

  Items.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    shopId = json['shop_id'];
    gameId = json['game_id'];
    name = json['name'];
    logo = json['logo'];
    price = json['price'];
    detail = json['detail'];
    valid = json['valid'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['shop_id'] = this.shopId;
    data['game_id'] = this.gameId;
    data['name'] = this.name;
    data['logo'] = this.logo;
    data['price'] = this.price;
    data['detail'] = this.detail;
    data['valid'] = this.valid;
    return data;
  }
}

class ShopUser {
  int score;

  ShopUser({this.score});

  ShopUser.fromJson(Map<String, dynamic> json) {
    score = json['score'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['score'] = this.score;
    return data;
  }
}

class ScoreList {
  List<ScoreListData> data;

  ScoreList({this.data});

  ScoreList.fromJson(Map<String, dynamic> json) {
    if (json['data'] != null) {
      data = new List<ScoreListData>();
      json['data'].forEach((v) {
        data.add(new ScoreListData.fromJson(v));
      });
    }
  }

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

class ScoreListData {
  int id;
  int userId;
  int score;
  String from;
  String detail;
  String createdAt;

  ScoreListData(
      {this.id,
        this.userId,
        this.score,
        this.from,
        this.detail,
        this.createdAt});

  ScoreListData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    userId = json['user_id'];
    score = json['score'];
    from = json['from'];
    detail = json['detail'];
    createdAt = json['created_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['user_id'] = this.userId;
    data['score'] = this.score;
    data['from'] = this.from;
    data['detail'] = this.detail;
    data['created_at'] = this.createdAt;
    return data;
  }
}