from django.db import models

class FileScan(models.Model):
    RISK_LEVELS = [
        ('LOW', 'Low'),
        ('MEDIUM', 'Medium'),
        ('HIGH', 'High'),
    ]

    filename = models.CharField(max_length=255)
    file_hash = models.CharField(max_length=64, db_index=True)  # SHA256
    risk_level = models.CharField(max_length=10, choices=RISK_LEVELS)
    reasons = models.TextField()
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return f"{self.filename} - {self.risk_level}"

    class Meta:
        ordering = ['-created_at']