# Generated by Django 5.2.7 on 2025-10-22 17:28

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


class Migration(migrations.Migration):

    dependencies = [
        ("ocpp", "0029_transaction_deprecate_vin"),
    ]

    operations = [
        migrations.CreateModel(
            name="ChargerConfiguration",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "charger_identifier",
                    models.CharField(max_length=100, verbose_name="Serial Number"),
                ),
                (
                    "connector_id",
                    models.PositiveIntegerField(
                        blank=True,
                        help_text="Connector that returned this configuration (if specified).",
                        null=True,
                        verbose_name="Connector ID",
                    ),
                ),
                (
                    "configuration_keys",
                    models.JSONField(
                        blank=True,
                        default=list,
                        help_text="Entries from the configurationKey list.",
                    ),
                ),
                (
                    "unknown_keys",
                    models.JSONField(
                        blank=True,
                        default=list,
                        help_text="Keys returned in the unknownKey list.",
                    ),
                ),
                (
                    "raw_payload",
                    models.JSONField(
                        blank=True,
                        default=dict,
                        help_text="Raw payload returned by the GetConfiguration call.",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "verbose_name": "CP Configuration",
                "verbose_name_plural": "CP Configurations",
                "ordering": ["-created_at"],
            },
        ),
        migrations.AddField(
            model_name="charger",
            name="configuration",
            field=models.ForeignKey(
                blank=True,
                help_text="Latest GetConfiguration response received from this charge point.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="chargers",
                to="ocpp.chargerconfiguration",
            ),
        ),
    ]
