"""
quizlib cloze question type
"""

from dataclasses import dataclass, field

from quizlib.types import QuestionType


@dataclass
class Cloze:
    """Cloze (fill-in-the-blank) question.

    The text contains special Moodle cloze syntax for blanks, e.g.:
    - {:MRH:=Ja#correct~Nein#incorrect} for multiple choice
    - {:NUMERICAL:=42:0} for numeric answers

    Attributes:
        name: Question identifier/title.
        text: Question text with embedded cloze syntax.
    """

    name: str
    text: str
    typ: QuestionType = field(default=QuestionType.CLOZE, init=False)


# Backwards-compatible alias
CZ = Cloze
