# Generated by Django 5.2 on 2025-05-22 14:50

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        (
            "services",
            "0025_computeplan_term_storageplan_term_storageplan_unit_and_more",
        ),
    ]

    operations = [
        migrations.CreateModel(
            name="ProgressiveDiscountModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=100)),
                ("description", models.TextField(blank=True)),
                ("active", models.BooleanField(default=True)),
            ],
        ),
        migrations.AddField(
            model_name="vshnappcatprice",
            name="valid_from",
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name="vshnappcatprice",
            name="valid_to",
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name="vshnappcatprice",
            name="discount_model",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="price_configs",
                to="services.progressivediscountmodel",
            ),
        ),
        migrations.CreateModel(
            name="DiscountTier",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "threshold",
                    models.PositiveIntegerField(
                        help_text="Starting unit count for this tier"
                    ),
                ),
                (
                    "discount_percent",
                    models.DecimalField(
                        decimal_places=2,
                        help_text="Percentage discount applied (0-100)",
                        max_digits=5,
                    ),
                ),
                (
                    "discount_model",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="tiers",
                        to="services.progressivediscountmodel",
                    ),
                ),
            ],
            options={
                "ordering": ["threshold"],
                "unique_together": {("discount_model", "threshold")},
            },
        ),
    ]
