from django.db import models

from Accounts .models import UserProfile
from Device.models import Devices
# Create your models here.
class Status(models.Model):
    number = models.CharField(max_length=15)
    def __str__(self):
        return self.number
    
class Number(models.Model):
    status = models.BooleanField(default=False)  # Default value is False (0)

    def __str__(self):
        return f"Number (ID: {self.id}, Status: {self.status})"
    
    
class SqlStatus(models.Model):
    value = models.CharField(max_length=15, default="0")
    
    def __str__(self):
        return f"Number (ID: {self.id}, Status: {self.value})"
    
class RestoreDatabase(models.Model):
    value = models.CharField(max_length=15, default="0")
    
    def __str__(self):
        return f"Number (ID: {self.id}, Status: {self.value})"
    


class DdosPrediction(models.Model):
    device = models.ForeignKey(Devices, on_delete=models.CASCADE)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)  # Add this field to reference the user
    file_path = models.FileField(upload_to='ddos_predictions/')
    uploaded_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return f"Prediction for {self.device.device_name} by {self.user.user.username} at {self.uploaded_at}"
    
class Rensomware_TypePrediction(models.Model):
    device = models.ForeignKey(Devices, on_delete=models.CASCADE)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)  # Add this field to reference the user
    file_path = models.FileField(upload_to='ransomware_predictions/', max_length=555)
    uploaded_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return f"Prediction for {self.device.device_name} by {self.user.user.username} at {self.uploaded_at}"

class Rensomware_AuditPrediction(models.Model):
    device = models.ForeignKey(Devices, on_delete=models.CASCADE)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)  # Add this field to reference the user
    file_path = models.FileField(upload_to='ransomware_predictions/',max_length=555)
    uploaded_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return f"Prediction for {self.device.device_name} by {self.user.user.username} at {self.uploaded_at}"
    
    