
class UniversalQuestionContent:
    def __init__(self, id, question_text, format, choices, correct_choices, input_rules, solution, question_type, tags, keywords):
        self.id = id
        self.question_text = question_text
        self.format = format
        self.choices = choices
        self.correct_choices = correct_choices
        self.input_rules = input_rules
        self.solution = solution
        self.question_type = question_type
        self.tags = tags
        self.keywords = keywords

    @classmethod
    def from_question_obj(cls, obj):
        return cls(
            id=obj.id,
            question_text=obj.question_text,
            format=obj.format,
            choices=obj.choices,
            correct_choices=obj.correct_choices,
            input_rules=obj.input_rules,
            solution=obj.solution,
            question_type=obj.question_type,
            tags=obj.tags,
            keywords=obj.keywords,
        )

    @classmethod
    def from_dict(cls, dict):
        return cls(
            id=dict.get("id"),
            question_text=dict.get("question_text"),
            format=dict.get("format"),
            choices=dict.get("choices"),
            correct_choices=dict.get("correct_choices"),
            input_rules=dict.get("input_rules"),
            solution=dict.get("solution"),
            question_type=dict.get("question_type"),
            tags=dict.get("tags"),
            keywords=dict.get("keywords"),
        )

    def to_dict(self):
        return {
            "id": str(self.id),
            "question_text": self.question_text,
            "format": self.format,
            "choices": self.choices,
            "correct_choices": self.correct_choices,
            "input_rules": self.input_rules,
            "solution": self.solution,
            "question_type": self.question_type,
            "tags": self.tags,
            "keywords": self.keywords,
        }
