from django.db import models

class MessengerEvent(models.Model):
    mid = models.CharField(max_length=255, unique=True, db_index=True)  # message id
    sender_id = models.CharField(max_length=64)
    page_id = models.CharField(max_length=64, blank=True, default="")
    payload = models.JSONField(default=dict, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.mid
