from django.db import models
from accounts.models import Users


class Notification(models.Model):
    NOTIFICATION_TYPES = (("chat", "Chat"), ("contract", "Contract"), ("work", "Work"), ("payment", "Payment"),)
    user = models.ForeignKey(Users,on_delete=models.CASCADE,related_name="notifications")
    title = models.CharField(max_length=255)
    body = models.TextField()
    notification_type = models.CharField(max_length=50,choices=NOTIFICATION_TYPES)
    reference_id = models.IntegerField(blank=True,null=True)
    is_read = models.BooleanField(default=False)
    metadata = models.JSONField(default=dict, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)