from django.db import models
from django.conf import settings

 

class Subscription(models.Model):
    user = models.ForeignKey(
        settings.AUTH_USER_MODEL, 
        blank=True, 
        on_delete=models.CASCADE,
        related_name='subscriptions'  # For user subscriptions
    )
  
  

    license_number = models.CharField(max_length=100)
    user_count = models.PositiveIntegerField(default=0, blank=True)
    startTime = models.DateTimeField()
    endTime = models.DateTimeField()
    price = models.DecimalField(max_digits=30, decimal_places=2)

    def __str__(self):
        return f"Subscription {self.user_count} - License: {self.license_number}"
