# Generated by Django 5.2.9 on 2025-12-21 00:30

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


class Migration(migrations.Migration):

    dependencies = [
        ("ocpp", "0006_monitoringreport_variable_monitoringrule_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="CustomerInformationRequest",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "ocpp_message_id",
                    models.CharField(
                        blank=True, max_length=64, verbose_name="OCPP message ID"
                    ),
                ),
                (
                    "request_id",
                    models.BigIntegerField(
                        blank=True, null=True, verbose_name="Request ID"
                    ),
                ),
                ("payload", models.JSONField(blank=True, default=dict)),
                ("last_notified_at", models.DateTimeField(blank=True, null=True)),
                ("completed_at", models.DateTimeField(blank=True, null=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "charger",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="customer_information_requests",
                        to="ocpp.charger",
                    ),
                ),
            ],
            options={
                "verbose_name": "Customer Information Request",
                "verbose_name_plural": "Customer Information Requests",
                "ordering": ["-created_at", "-pk"],
            },
        ),
        migrations.CreateModel(
            name="DisplayMessageNotification",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "ocpp_message_id",
                    models.CharField(max_length=64, verbose_name="OCPP message ID"),
                ),
                (
                    "request_id",
                    models.BigIntegerField(
                        blank=True, null=True, verbose_name="Request ID"
                    ),
                ),
                (
                    "tbc",
                    models.BooleanField(default=False, verbose_name="To Be Continued"),
                ),
                ("raw_payload", models.JSONField(blank=True, default=dict)),
                ("received_at", models.DateTimeField(auto_now_add=True)),
                ("completed_at", models.DateTimeField(blank=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "charger",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="display_message_notifications",
                        to="ocpp.charger",
                    ),
                ),
            ],
            options={
                "verbose_name": "Display Message Notification",
                "verbose_name_plural": "Display Message Notifications",
                "ordering": ["-received_at", "-pk"],
            },
        ),
        migrations.CreateModel(
            name="CustomerInformationChunk",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "ocpp_message_id",
                    models.CharField(max_length=64, verbose_name="OCPP message ID"),
                ),
                (
                    "request_id",
                    models.BigIntegerField(
                        blank=True, null=True, verbose_name="Request ID"
                    ),
                ),
                ("data", models.TextField(blank=True, default="")),
                (
                    "tbc",
                    models.BooleanField(default=False, verbose_name="To Be Continued"),
                ),
                ("raw_payload", models.JSONField(blank=True, default=dict)),
                ("received_at", models.DateTimeField(auto_now_add=True)),
                (
                    "charger",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="customer_information_chunks",
                        to="ocpp.charger",
                    ),
                ),
                (
                    "request_record",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="chunks",
                        to="ocpp.customerinformationrequest",
                    ),
                ),
            ],
            options={
                "verbose_name": "Customer Information Chunk",
                "verbose_name_plural": "Customer Information Chunks",
                "ordering": ["-received_at", "-pk"],
            },
        ),
        migrations.CreateModel(
            name="DisplayMessage",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "message_id",
                    models.BigIntegerField(
                        blank=True, null=True, verbose_name="Message ID"
                    ),
                ),
                ("priority", models.CharField(blank=True, max_length=32)),
                ("state", models.CharField(blank=True, max_length=32)),
                ("valid_from", models.DateTimeField(blank=True, null=True)),
                ("valid_to", models.DateTimeField(blank=True, null=True)),
                ("language", models.CharField(blank=True, max_length=16)),
                ("content", models.TextField(blank=True)),
                ("component_name", models.CharField(blank=True, max_length=200)),
                ("component_instance", models.CharField(blank=True, max_length=200)),
                ("variable_name", models.CharField(blank=True, max_length=200)),
                ("variable_instance", models.CharField(blank=True, max_length=200)),
                ("raw_payload", models.JSONField(blank=True, default=dict)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "charger",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="display_messages",
                        to="ocpp.charger",
                    ),
                ),
                (
                    "notification",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="messages",
                        to="ocpp.displaymessagenotification",
                    ),
                ),
            ],
            options={
                "verbose_name": "Display Message",
                "verbose_name_plural": "Display Messages",
                "ordering": ["-created_at", "-pk"],
            },
        ),
        migrations.AddIndex(
            model_name="customerinformationrequest",
            index=models.Index(
                fields=["ocpp_message_id"],
                name="ocpp_custinfo_ocpp_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="customerinformationrequest",
            index=models.Index(
                fields=["charger", "request_id"],
                name="ocpp_custinfo_req_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="displaymessagenotification",
            index=models.Index(
                fields=["ocpp_message_id"],
                name="ocpp_display_ocpp_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="displaymessagenotification",
            index=models.Index(
                fields=["charger", "request_id"],
                name="ocpp_display_req_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="customerinformationchunk",
            index=models.Index(
                fields=["ocpp_message_id"],
                name="ocpp_custinfochunk_ocpp_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="customerinformationchunk",
            index=models.Index(
                fields=["charger", "request_id"],
                name="ocpp_custinfochunk_req_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="displaymessage",
            index=models.Index(
                fields=["message_id"],
                name="ocpp_display_msg_idx",
            ),
        ),
    ]
