from django.db import models
from uuid import uuid4

class BalanceTransfer(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
    sender = models.ForeignKey('profiles.Profile', on_delete=models.CASCADE, related_name='sent_transfers')
    receiver = models.ForeignKey('profiles.Profile', on_delete=models.CASCADE, related_name='received_transfers')
    amount = models.DecimalField(max_digits=12, decimal_places=2) 
    fee = models.DecimalField(max_digits=12, decimal_places=2)    
    timestamp = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return f"From {self.sender.user.email} to {self.receiver.user.email} - {self.amount}"