from django.db import models
from django.contrib.postgres.fields import ArrayField

from .semester import Semester


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

    Args:
        models (_type_): model class

    Returns:
        _type_: string object (Outcome.heading)
    """
    heading = models.CharField(max_length=150)
    questions = ArrayField(models.CharField(max_length=100))
    semester = models.ForeignKey(Semester, on_delete=models.DO_NOTHING)

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

    class Meta:
        ordering = ['heading']
        unique_together = (('heading', 'semester'),)
