class Competitions {
  int? pageIndex;
  int? pageSize;
  int? totalPages;
  int? totalItems;
  List<ItemsCompetitions>? items;

  Competitions(
      {this.pageIndex,
        this.pageSize,
        this.totalPages,
        this.totalItems,
        this.items});

  Competitions.fromJson(Map<String, dynamic> json) {
    pageIndex = json['pageIndex'];
    pageSize = json['pageSize'];
    totalPages = json['totalPages'];
    totalItems = json['totalItems'];
    if (json['items'] != null) {
      items = <ItemsCompetitions>[];
      json['items'].forEach((v) {
        items!.add(ItemsCompetitions.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['pageIndex'] = pageIndex;
    data['pageSize'] = pageSize;
    data['totalPages'] = totalPages;
    data['totalItems'] = totalItems;
    if (items != null) {
      data['items'] = items!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class ItemsCompetitions {
  String? id;
  String? competitionId;
  String? name;
  String? isLeague;
  String? isCup;
  String? tier;
  String? hasGroups;
  String? active;
  String? nationalTeamsOnly;
  Season? season;
  Country? country;
  bool? status;
  int? iV;
  String? category;
  bool? favourite;
  String ? logo;


  ItemsCompetitions(
      {this.id,
        this.competitionId,
        this.name,
        this.isLeague,
        this.isCup,
        this.tier,
        this.hasGroups,
        this.active,
        this.logo,
        this.nationalTeamsOnly,
        this.season,
        this.country,
        this.status,
        this.favourite,
        this.iV,
        this.category});

  ItemsCompetitions.fromJson(Map<String, dynamic> json) {
    id = json['_id'];
    competitionId = json['competitionId'];
    name = json['name'];
    isLeague = json['isLeague'];
    isCup = json['isCup'];
    tier = json['tier'];
    hasGroups = json['hasGroups'];
    active = json['active'];
    logo = json['logo'];
    nationalTeamsOnly = json['nationalTeamsOnly'];
    season = json['season'] != null ? Season.fromJson(json['season']) : null;
    country =
    json['country'] != null ? Country.fromJson(json['country']) : null;
    status = json['status'];
    favourite = json['favourite'];
    iV = json['__v'];
    category = json['category'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['_id'] = id;
    data['competitionId'] = competitionId;
    data['name'] = name;
    data['isLeague'] = isLeague;
    data['isCup'] = isCup;
    data['tier'] = tier;
    data['hasGroups'] = hasGroups;
    data['active'] = active;
    data['logo'] = logo;
    data['nationalTeamsOnly'] = nationalTeamsOnly;
    if (season != null) {
      data['season'] = season!.toJson();
    }
    if (country != null) {
      data['country'] = country!.toJson();
    }
    data['status'] = status;
    data['favourite'] = favourite;
    data['__v'] = iV;
    data['category'] = category;
    return data;
  }
}

class Season {
  String? sId;
  String? seasonId;
  String? name;
  String? start;
  String? end;
  int? iV;
  bool? status;

  Season(
      {this.sId,
        this.seasonId,
        this.name,
        this.start,
        this.end,
        this.iV,
        this.status});

  Season.fromJson(Map<String, dynamic> json) {
    sId = json['_id'];
    seasonId = json['seasonId'];
    name = json['name'];
    start = json['start'];
    end = json['end'];
    iV = json['__v'];
    status = json['status'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['_id'] = sId;
    data['seasonId'] = seasonId;
    data['name'] = name;
    data['start'] = start;
    data['end'] = end;
    data['__v'] = iV;
    data['status'] = status;
    return data;
  }
}

class Country {
  String? sId;
  String? countryId;
  String? name;

  Country({this.sId, this.countryId, this.name});

  Country.fromJson(Map<String, dynamic> json) {
    sId = json['_id'];
    countryId = json['countryId'];
    name = json['name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['_id'] = sId;
    data['countryId'] = countryId;
    data['name'] = name;
    return data;
  }
}