# Generated by Django 5.2 on 2025-05-20 13:25

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


class Migration(migrations.Migration):

    dependencies = [
        ("services", "0022_computeplan"),
    ]

    operations = [
        migrations.AlterModelOptions(
            name="computeplan",
            options={"ordering": ["name"]},
        ),
        migrations.RemoveField(
            model_name="computeplan",
            name="price_chf",
        ),
        migrations.RemoveField(
            model_name="computeplan",
            name="price_eur",
        ),
        migrations.RemoveField(
            model_name="computeplan",
            name="price_usd",
        ),
        migrations.CreateModel(
            name="VSHNAppCatPrice",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "variable_unit",
                    models.CharField(
                        choices=[
                            ("RAM", "Memory (RAM)"),
                            ("CPU", "CPU (vCPU)"),
                            ("USR", "Users"),
                        ],
                        default="RAM",
                        max_length=3,
                    ),
                ),
                (
                    "ha_replica_min",
                    models.IntegerField(
                        default=1, help_text="Minimum of replicas for HA"
                    ),
                ),
                (
                    "ha_replica_max",
                    models.IntegerField(
                        default=1, help_text="Maximum supported replicas"
                    ),
                ),
                (
                    "service",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="vshn_appcat_price",
                        to="services.service",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="ComputePlanPrice",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "currency",
                    models.CharField(
                        choices=[
                            ("CHF", "Swiss Franc"),
                            ("EUR", "Euro"),
                            ("USD", "US Dollar"),
                        ],
                        max_length=3,
                    ),
                ),
                (
                    "amount",
                    models.DecimalField(
                        decimal_places=2,
                        help_text="Price in the specified currency, excl. VAT",
                        max_digits=10,
                    ),
                ),
                (
                    "compute_plan",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="prices",
                        to="services.computeplan",
                    ),
                ),
            ],
            options={
                "ordering": ["currency"],
                "unique_together": {("compute_plan", "currency")},
            },
        ),
        migrations.CreateModel(
            name="VSHNAppCatBaseFee",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "currency",
                    models.CharField(
                        choices=[
                            ("CHF", "Swiss Franc"),
                            ("EUR", "Euro"),
                            ("USD", "US Dollar"),
                        ],
                        max_length=3,
                    ),
                ),
                (
                    "amount",
                    models.DecimalField(
                        decimal_places=2,
                        help_text="Base fee in the specified currency, excl. VAT",
                        max_digits=10,
                    ),
                ),
                (
                    "vshn_appcat_price_config",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="base_fees",
                        to="services.vshnappcatprice",
                    ),
                ),
            ],
            options={
                "ordering": ["currency"],
                "unique_together": {("vshn_appcat_price_config", "currency")},
            },
        ),
        migrations.CreateModel(
            name="VSHNAppCatUnitRate",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "currency",
                    models.CharField(
                        choices=[
                            ("CHF", "Swiss Franc"),
                            ("EUR", "Euro"),
                            ("USD", "US Dollar"),
                        ],
                        max_length=3,
                    ),
                ),
                (
                    "service_level",
                    models.CharField(
                        choices=[
                            ("BE", "Best Effort"),
                            ("GA", "Guaranteed Availability"),
                        ],
                        max_length=2,
                    ),
                ),
                (
                    "amount",
                    models.DecimalField(
                        decimal_places=4,
                        help_text="Price per unit in the specified currency and service level, excl. VAT",
                        max_digits=10,
                    ),
                ),
                (
                    "vshn_appcat_price_config",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="unit_rates",
                        to="services.vshnappcatprice",
                    ),
                ),
            ],
            options={
                "ordering": ["currency", "service_level"],
                "unique_together": {
                    ("vshn_appcat_price_config", "currency", "service_level")
                },
            },
        ),
    ]
