from django.db import models
import uuid
from django.utils.timezone import now
from datetime import timedelta

class EmailConfirmation(models.Model):
    email = models.EmailField(unique=True)
    uuid = models.UUIDField(default=uuid.uuid4, unique=True)
    created_at = models.DateTimeField(auto_now_add=True)

    def is_expired(self):
        return now() > (self.created_at + timedelta(days=1))