from typing import List, Dict, Any


class Challenge:
    def __init__(
        self,
        name: str,
        difficulty: str,
        language: str,
        subject: str,
        description: str,
        requirements: List[str],
        hints: List[str],
        validation_check: str,
        expected_output: str,
    ):
        self.name = name
        self.difficulty = difficulty
        self.language = language
        self.subject = subject if subject else "General Software Engineering"
        self.description = description
        self.requirements = requirements
        self.hints = hints
        self.validation_check = validation_check
        self.expected_output = expected_output

    def __repr__(self) -> str:
        return f"<Challenge: {self.name} [{self.subject}] ({self.language})>"

    def to_dict(self, challenge_id: str = "") -> Dict[str, Any]:
        return {
            "id": challenge_id,
            "challenge_id": challenge_id,
            "name": self.name,
            "difficulty": self.difficulty,
            "language": self.language,
            "subject": self.subject,
            "description": self.description,
            "requirements": self.requirements,
            "hints": self.hints,
            "validation_check": self.validation_check,
            "expected_output": self.expected_output,
        }
