class MarathonDetailModel {
  String? id;
  String? titleEn;
  String? titleAr;
  String? descEn;
  String? descAr;
  int? winDeciderTime;
  int? winnersCount;
  int? questGapTime;
  String? startTime;
  String? endTime;
  int? marathoneStatusId;
  String? scheduleTime;
  int? selectedLanguage;
  Projects? projects;
  List<Sponsors>? sponsors;
  List<Questions>? questions;
  int? totalQuestions;
  int? marathonBufferTime;

  MarathonDetailModel({
    id,
    titleEn,
    titleAr,
    descEn,
    descAr,
    winDeciderTime,
    winnersCount,
    questGapTime,
    startTime,
    endTime,
    marathoneStatusId,
    scheduleTime,
    selectedLanguage,
    projects,
    sponsors,
    questions,
    totalQuestions,
    marathonBufferTime,
  });

  MarathonDetailModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    titleEn = json['titleEn'];
    titleAr = json['titleAr'];
    descEn = json['descEn'];
    descAr = json['descAr'];
    winDeciderTime = json['winDeciderTime'];
    winnersCount = json['winnersCount'];
    questGapTime = json['questGapTime'];
    startTime = json['startTime'];
    endTime = json['endTime'];
    marathoneStatusId = json['marathoneStatusId'];
    scheduleTime = json['scheduleTime'];
    selectedLanguage = json['selectedLanguage'];
    projects = json['projects'] != null ? Projects.fromJson(json['projects']) : null;
    if (json['sponsors'] != null) {
      sponsors = <Sponsors>[];
      json['sponsors'].forEach((v) {
        sponsors!.add(Sponsors.fromJson(v));
      });
    }
    if (json['questions'] != null) {
      questions = <Questions>[];
      json['questions'].forEach((v) {
        questions!.add(Questions.fromJson(v));
      });
    }
    totalQuestions = json["totalQuestions"];
    marathonBufferTime = json["marathonBufferTime"];
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['titleEn'] = titleEn;
    data['titleAr'] = titleAr;
    data['descEn'] = descEn;
    data['descAr'] = descAr;
    data['winDeciderTime'] = winDeciderTime;
    data['winnersCount'] = winnersCount;
    data['questGapTime'] = questGapTime;
    data['startTime'] = startTime;
    data['endTime'] = endTime;
    data['marathoneStatusId'] = marathoneStatusId;
    data['scheduleTime'] = scheduleTime;
    data['selectedLanguage'] = selectedLanguage;
    if (projects != null) {
      data['projects'] = projects!.toJson();
    }
    if (sponsors != null) {
      data['sponsors'] = sponsors!.map((v) => v.toJson()).toList();
    }
    if (questions != null) {
      data['questions'] = questions!.map((v) => v.toJson()).toList();
    }
    data['totalQuestions'] = totalQuestions;
    data['marathonBufferTime'] = marathonBufferTime;

    return data;
  }
}

class Projects {
  String? id;
  String? nameEn;
  String? nameAr;
  String? projectCode;

  Projects({id, nameEn, nameAr, projectCode});

  Projects.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    nameEn = json['nameEn'];
    nameAr = json['nameAr'];
    projectCode = json['projectCode'];
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['nameEn'] = nameEn;
    data['nameAr'] = nameAr;
    data['projectCode'] = projectCode;
    return data;
  }
}

class Sponsors {
  String? id;
  String? nameEn;
  String? nameAr;
  String? image;
  String? video;
  String? logo;
  List<SponsorPrizes>? sponsorPrizes;

  Sponsors({id, nameEn, nameAr, image, video, logo, sponsorPrizes});

  Sponsors.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    nameEn = json['nameEn'];
    nameAr = json['nameAr'];
    image = json['image'];
    video = json['video'];
    logo = json['logo'];
    if (json['sponsorPrizes'] != null) {
      sponsorPrizes = <SponsorPrizes>[];
      json['sponsorPrizes'].forEach((v) {
        sponsorPrizes!.add(SponsorPrizes.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['nameEn'] = nameEn;
    data['nameAr'] = nameAr;
    data['image'] = image;
    data['video'] = video;
    data['logo'] = logo;
    if (sponsorPrizes != null) {
      data['sponsorPrizes'] = sponsorPrizes!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class SponsorPrizes {
  String? id;
  String? marathonPrizeEn;
  String? marathonPrizeAr;

  SponsorPrizes({id, marathonPrizeEn, marathonPrizeAr});

  SponsorPrizes.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    marathonPrizeEn = json['marathonPrizeEn'];
    marathonPrizeAr = json['marathonPrizeAr'];
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['marathonPrizeEn'] = marathonPrizeEn;
    data['marathonPrizeAr'] = marathonPrizeAr;
    return data;
  }
}

class Questions {
  String? id;
  String? titleEn;
  String? titleAr;
  String? marathonId;
  int? questionTypeId;
  int? questionTime;
  int? nextQuestGap;
  int? gapType;
  String? gapValue;
  String? gapImage;
  int? questOptionsLimit;
  List? questionOptions;

  Questions({id, titleEn, titleAr, marathonId, questionTypeId, questionTime, nextQuestGap, gapType, gapValue, gapImage, questOptionsLimit, questionOptions});

  Questions.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    titleEn = json['titleEn'];
    titleAr = json['titleAr'];
    marathonId = json['marathonId'];
    questionTypeId = json['questionTypeId'];
    questionTime = json['questionTime'];
    nextQuestGap = json['nextQuestGap'];
    gapType = json['gapType'];
    gapValue = json['gapValue'];
    gapImage = json['gapImage'];
    questOptionsLimit = json['questOptionsLimit'];
    questionOptions = json['questionOptions'];
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['titleEn'] = titleEn;
    data['titleAr'] = titleAr;
    data['marathonId'] = marathonId;
    data['questionTypeId'] = questionTypeId;
    data['questionTime'] = questionTime;
    data['nextQuestGap'] = nextQuestGap;
    data['gapType'] = gapType;
    data['gapValue'] = gapValue;
    data['gapImage'] = gapImage;
    data['questOptionsLimit'] = questOptionsLimit;
    data['questionOptions'] = questionOptions;
    return data;
  }
}
