import 'dart:convert';

import 'package:flutter/services.dart';
import 'package:logger/logger.dart' as L;
import 'package:mohem_flutter_app/models/marathon/marathon_model.dart';
import 'package:mohem_flutter_app/models/marathon/question_model.dart';

class DemoMarathonRepo {
  L.Logger logger = L.Logger();

  Future<MarathonDetailModel> getDemoMarathonDetails() async {
    String response = await rootBundle.loadString('assets/json/demo_upcoming_marathon');
    var json = jsonDecode(response);
    MarathonDetailModel marathonDetailModel = MarathonDetailModel.fromJson(json);
    return marathonDetailModel;
  }

  Future<QuestionModel> getDemoNextQuestion({required int currentQuestionNumber}) async {
    String response = await rootBundle.loadString('assets/json/demo_questions_marathon');
    List json = jsonDecode(response);
    QuestionModel currentQuestion = QuestionModel.fromJson(json.elementAt(currentQuestionNumber));

    return currentQuestion;
  }
}
