import 'package:english_learning/features/learning/modules/result/widgets/complete_result_widget.dart';
import 'package:english_learning/features/learning/modules/result/widgets/down_result_widget.dart';
import 'package:english_learning/features/learning/modules/result/widgets/jump_result_widget.dart';
import 'package:flutter/material.dart';
import 'package:english_learning/core/utils/styles/theme.dart';

class ResultScreen extends StatelessWidget {
  final String currentLevel;
  final String nextLevel;
  final int score;
  final bool isCompleted;
  final String? stdLearningId;
  final String topicId;
  final String topicTitle;

  const ResultScreen({
    super.key,
    required this.currentLevel,
    required this.nextLevel,
    required this.score,
    required this.isCompleted,
    this.stdLearningId,
    required this.topicId,
    required this.topicTitle,
  });

  @override
  Widget build(BuildContext context) {
    // final mediaQuery = MediaQuery.of(context);
    // final screenHeight = mediaQuery.size.height;

    return Scaffold(
      backgroundColor: AppColors.bgSoftColor,
      body: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 32.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            if (isCompleted)
              CompleteResultWidget(
                currentLevel: currentLevel,
                score: score,
                stdLearningId: stdLearningId ?? '',
                topicId: topicId, // Tambahkan ini
                topicTitle: topicTitle, // Tambahkan ini
              )
            else if (nextLevel != currentLevel)
              JumpResultWidget(
                nextLevel: nextLevel,
                score: score,
                stdLearningId: stdLearningId ?? '',
                topicId: topicId, // Tambahkan ini
                topicTitle: topicTitle, // Tambahkan ini
              )
            else
              DownResultWidget(
                nextLevel: nextLevel,
                score: score,
                stdLearningId: stdLearningId ?? '',
                topicId: topicId, // Tambahkan ini
                topicTitle: topicTitle, // Tambahkan ini
              ),
          ],
        ),
      ),
    );
  }
}
