import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/models/marathon/question_model.dart';

class QuestionCardBuilder extends StatelessWidget {
  final WidgetBuilder onQuestion;
  final WidgetBuilder onCompleted;
  final WidgetBuilder onWrongAnswer;
  final WidgetBuilder onCorrectAnswer;
  final WidgetBuilder onWinner;
  final WidgetBuilder onSkippedAnswer;
  final WidgetBuilder onFindingWinner;
  final QuestionCardStatus questionCardStatus;

  const QuestionCardBuilder({
    Key? key,
    required this.onQuestion,
    required this.onCompleted,
    required this.onCorrectAnswer,
    required this.onWinner,
    required this.onSkippedAnswer,
    required this.onWrongAnswer,
    required this.onFindingWinner,
    required this.questionCardStatus,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    switch (questionCardStatus) {
      case QuestionCardStatus.question:
        return onQuestion(context);

      case QuestionCardStatus.wrongAnswer:
        return onWrongAnswer(context);

      case QuestionCardStatus.correctAnswer:
        return onCorrectAnswer(context);

      case QuestionCardStatus.completed:
        return onCompleted(context);

      case QuestionCardStatus.winnerFound:
        return onWinner(context);

      case QuestionCardStatus.findingWinner:
        return onFindingWinner(context);

      case QuestionCardStatus.skippedAnswer:
        return onSkippedAnswer(context);
    }
  }
}
