from django.db import models

from .semester import Semester


class GenQuestion(models.Model):
    """A class that inherits from the model class which 
    create a GenQuestion model.This GenQuestion model 
    defines a datastore entity.
    This class is ordering by GenQuestion.order

    Args:
        models (_type_): model class

    Returns:
        _type_: array of character (GenQeustion.text)
    """
    text = models.CharField(max_length=100)
    order = models.IntegerField(default=1)
    semester = models.ForeignKey(Semester, on_delete=models.CASCADE)

    def __str__(self) -> str:
        return f'{self.text}'

    class Meta:
        ordering = ['order']
