from django.db import models
import uuid


# Create your models here.
class ContactUs(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    created_at = models.DateTimeField(auto_now_add=True)
    first_name = models.CharField(max_length=255)
    last_name = models.CharField(max_length=255)
    email = models.EmailField()
    contact_number = models.CharField(max_length=500)
    inquiry = models.TextField()
    status = models.CharField(max_length=255, default="pending")

    def __str__(self):
        return f"{self.email} - submitted on {self.created_at.strftime('%B %d, %Y')}"

    def save(self, *args, **kwargs):
        self.status = self.status.lower()

        super(ContactUs, self).save(*args, **kwargs)
