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

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


class Migration(migrations.Migration):

    dependencies = [
        ("ocpp", "0004_remove_rfid_proxy"),
    ]

    operations = [
        migrations.CreateModel(
            name="CertificateOperation",
            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)),
                (
                    "action",
                    models.CharField(
                        choices=[
                            ("InstallCertificate", "Install certificate"),
                            ("DeleteCertificate", "Delete certificate"),
                            ("CertificateSigned", "Certificate signed"),
                            (
                                "GetInstalledCertificateIds",
                                "Get installed certificate ids",
                            ),
                        ],
                        max_length=80,
                    ),
                ),
                (
                    "certificate_type",
                    models.CharField(blank=True, default="", max_length=80),
                ),
                ("certificate_hash_data", models.JSONField(blank=True, default=dict)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("Pending", "Pending"),
                            ("Accepted", "Accepted"),
                            ("Rejected", "Rejected"),
                            ("Error", "Error"),
                        ],
                        default="Pending",
                        max_length=20,
                    ),
                ),
                ("status_info", models.TextField(blank=True, default="")),
                ("request_payload", models.JSONField(blank=True, default=dict)),
                ("response_payload", models.JSONField(blank=True, default=dict)),
                (
                    "error_code",
                    models.CharField(blank=True, default="", max_length=120),
                ),
                ("error_description", models.TextField(blank=True, default="")),
                ("requested_at", models.DateTimeField(auto_now_add=True)),
                ("responded_at", models.DateTimeField(blank=True, null=True)),
                (
                    "charger",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="certificate_operations",
                        to="ocpp.charger",
                    ),
                ),
            ],
            options={
                "verbose_name": "Certificate operation",
                "verbose_name_plural": "Certificate operations",
                "ordering": ["-requested_at", "-pk"],
            },
        ),
        migrations.CreateModel(
            name="CertificateRequest",
            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)),
                (
                    "action",
                    models.CharField(
                        choices=[
                            ("SignCertificate", "Sign Certificate"),
                            ("Get15118EVCertificate", "Get 15118 EV Certificate"),
                        ],
                        max_length=80,
                    ),
                ),
                (
                    "certificate_type",
                    models.CharField(blank=True, default="", max_length=80),
                ),
                ("csr", models.TextField(blank=True, default="")),
                ("signed_certificate", models.TextField(blank=True, default="")),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("Pending", "Pending"),
                            ("Accepted", "Accepted"),
                            ("Rejected", "Rejected"),
                            ("Error", "Error"),
                        ],
                        default="Pending",
                        max_length=20,
                    ),
                ),
                ("status_info", models.TextField(blank=True, default="")),
                ("request_payload", models.JSONField(blank=True, default=dict)),
                ("response_payload", models.JSONField(blank=True, default=dict)),
                ("requested_at", models.DateTimeField(auto_now_add=True)),
                ("responded_at", models.DateTimeField(blank=True, null=True)),
                (
                    "charger",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="certificate_requests",
                        to="ocpp.charger",
                    ),
                ),
            ],
            options={
                "verbose_name": "Certificate request",
                "verbose_name_plural": "Certificate requests",
                "ordering": ["-requested_at", "-pk"],
            },
        ),
        migrations.CreateModel(
            name="CertificateStatusCheck",
            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)),
                ("certificate_hash_data", models.JSONField(blank=True, default=dict)),
                ("ocsp_result", models.JSONField(blank=True, default=dict)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("Pending", "Pending"),
                            ("Accepted", "Accepted"),
                            ("Rejected", "Rejected"),
                            ("Error", "Error"),
                        ],
                        default="Pending",
                        max_length=20,
                    ),
                ),
                ("status_info", models.TextField(blank=True, default="")),
                ("request_payload", models.JSONField(blank=True, default=dict)),
                ("response_payload", models.JSONField(blank=True, default=dict)),
                ("requested_at", models.DateTimeField(auto_now_add=True)),
                ("responded_at", models.DateTimeField(blank=True, null=True)),
                (
                    "charger",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="certificate_status_checks",
                        to="ocpp.charger",
                    ),
                ),
            ],
            options={
                "verbose_name": "Certificate status check",
                "verbose_name_plural": "Certificate status checks",
                "ordering": ["-requested_at", "-pk"],
            },
        ),
        migrations.CreateModel(
            name="InstalledCertificate",
            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)),
                (
                    "certificate_type",
                    models.CharField(blank=True, default="", max_length=80),
                ),
                ("certificate", models.TextField(blank=True, default="")),
                ("certificate_hash_data", models.JSONField(blank=True, default=dict)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("Pending", "Pending"),
                            ("Installed", "Installed"),
                            ("Rejected", "Rejected"),
                            ("DeletePending", "Delete pending"),
                            ("Deleted", "Deleted"),
                            ("Error", "Error"),
                        ],
                        default="Pending",
                        max_length=20,
                    ),
                ),
                (
                    "last_action",
                    models.CharField(blank=True, default="", max_length=80),
                ),
                ("installed_at", models.DateTimeField(blank=True, null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                (
                    "charger",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="installed_certificates",
                        to="ocpp.charger",
                    ),
                ),
            ],
            options={
                "verbose_name": "Installed certificate",
                "verbose_name_plural": "Installed certificates",
                "ordering": ["-pk"],
            },
        ),
        migrations.CreateModel(
            name="TrustAnchor",
            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)),
                ("name", models.CharField(blank=True, default="", max_length=120)),
                ("certificate", models.TextField(blank=True, default="")),
                ("certificate_hash_data", models.JSONField(blank=True, default=dict)),
                ("is_active", models.BooleanField(default=True)),
                (
                    "charger",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="trust_anchors",
                        to="ocpp.charger",
                    ),
                ),
            ],
            options={
                "verbose_name": "Trust anchor",
                "verbose_name_plural": "Trust anchors",
                "ordering": ["name", "pk"],
            },
        ),
    ]
