from django.db import models

from core.http.models import AbstractBaseModel


class Notification(AbstractBaseModel):
    title = models.CharField(max_length=255, verbose_name="Title")
    body = models.TextField(verbose_name="Body")
    user = models.ForeignKey(
        "http.User",
        on_delete=models.CASCADE,
        related_name="notifications",
        verbose_name="User",
        null=True,
        blank=True,
    )
    is_read = models.BooleanField(default=False, verbose_name="Is read")
    is_sending = models.BooleanField(default=False, verbose_name="Is sending")

    def __str__(self) -> str:
        return self.title

    class Meta:
        verbose_name = "Notification"
        verbose_name_plural = "Notifications"
