# Generated by Django 5.2.8 on 2025-11-14 13:50

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


class Migration(migrations.Migration):

    dependencies = [
        ("core", "0102_countdowntimer"),
        ("nodes", "0041_merge_20251113_2121"),
        ("ocpp", "0050_cpfirmwarerequest_is_deleted_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name="charger",
            name="ws_auth_group",
            field=models.ForeignKey(
                blank=True,
                help_text="Charge point connections must authenticate with HTTP Basic as a member of this security group.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="ws_group_authenticated_chargers",
                to="core.securitygroup",
                verbose_name="WS Auth Group",
            ),
        ),
        migrations.AddField(
            model_name="charger",
            name="ws_auth_user",
            field=models.ForeignKey(
                blank=True,
                help_text="Charge point connections must authenticate with HTTP Basic using this user.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="ws_authenticated_chargers",
                to=settings.AUTH_USER_MODEL,
                verbose_name="WS Auth User",
            ),
        ),
        migrations.AddConstraint(
            model_name="charger",
            constraint=models.CheckConstraint(
                condition=models.Q(
                    ("ws_auth_user__isnull", True),
                    ("ws_auth_group__isnull", True),
                    _connector="OR",
                ),
                name="charger_ws_auth_user_or_group",
            ),
        ),
    ]
