from django.db import models


class Plan(models.Model):
    name = models.CharField(max_length=50, unique=True)
    description = models.TextField(blank=True, default='')
    billing_mode = models.CharField(max_length=50, default='per_domain_monthly')
    base_price_per_domain = models.DecimalField(max_digits=10, decimal_places=2, default=0)
    included_traffic_gb_per_domain = models.PositiveIntegerField(default=0)
    overage_price_per_gb = models.DecimalField(max_digits=10, decimal_places=2, default=0)
    allow_overage = models.BooleanField(default=True)
    is_active = models.BooleanField(default=True)
    is_public = models.BooleanField(default=True)
    allow_new_purchase = models.BooleanField(default=True)
    allow_renew = models.BooleanField(default=True)
    features = models.JSONField(default=dict, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    class Meta:
        verbose_name = '套餐'
        verbose_name_plural = '套餐'

    def __str__(self):
        return self.name

# Create your models here.
