# Generated by Django 3.1 on 2020-10-20 11:54

from django.db import migrations, models

import payments


class Migration(migrations.Migration):

    dependencies = [
        ("payments", "0011_rename_ordertoken_order_field"),
    ]

    operations = [
        migrations.AlterField(
            model_name="additionalproduct",
            name="service",
            field=models.CharField(
                choices=[
                    ("electricity", "Electricity"),
                    ("water", "Water"),
                    ("gate", "Gate"),
                    ("mooring", "Mooring"),
                    ("waste_collection", "Waste collection"),
                    ("lighting", "Lighting"),
                    (
                        "summer_storage_for_docking_equipment",
                        "Summer storage for docking equipment",
                    ),
                    ("summer_storage_for_trailers", "Summer storage for trailers"),
                    ("storage_on_ice", "Storage on ice"),
                    ("parking_permit", "Parking permit"),
                    ("dinghy_place", "Dinghy place"),
                ],
                max_length=40,
                verbose_name="service",
            ),
        ),
        migrations.RemoveConstraint(
            model_name="additionalproduct",
            name="optional_services_per_period",
        ),
        migrations.AddConstraint(
            model_name="additionalproduct",
            constraint=models.UniqueConstraint(
                condition=models.Q(
                    service__in=[
                        payments.enums.ProductServiceType(
                            "summer_storage_for_docking_equipment"
                        ),
                        payments.enums.ProductServiceType(
                            "summer_storage_for_trailers"
                        ),
                        payments.enums.ProductServiceType("storage_on_ice"),
                        payments.enums.ProductServiceType("parking_permit"),
                        payments.enums.ProductServiceType("dinghy_place"),
                    ]
                ),
                fields=("service", "period"),
                name="optional_services_per_period",
            ),
        ),
    ]
