from django.db import models
from django.conf import settings

User = settings.AUTH_USER_MODEL


class ActivityLog(models.Model):
    ACTION_CHOICES = (
        ('payment', 'Payment'),
        ('approval', 'Approval'),
        ('repair', 'Repair'),
        ('complaint', 'Complaint'),
        ('edit', 'Edit'),
    )

    user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
    action = models.CharField(max_length=50, choices=ACTION_CHOICES)
    description = models.TextField()

    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return f"{self.user} - {self.action}"