from django.db import models
from django.utils.translation import gettext_lazy as _
from notifications.base.models import AbstractNotification


class NotificationType(models.TextChoices):
    USER_INTERACTION = "USER_INTERACTION", _("User Interaction")
    PROGRESS = "PROGRESS", _("Progress")
    INFORMATION = "INFORMATION", _("Information")


class Notification(AbstractNotification):
    notification_type = models.CharField(
        max_length=32,
        choices=NotificationType.choices,
        default=NotificationType.INFORMATION,
    )
    target_url = models.URLField(blank=True, null=True)
    actor_avatar_url = models.URLField(blank=True, null=True)
    course = models.CharField(max_length=32, blank=True, null=True)

    class Meta(AbstractNotification.Meta):
        abstract = False
        ordering = ["-timestamp"]
