# Generated by Django 5.2.9 on 2026-01-03 18:22

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


class Migration(migrations.Migration):

    dependencies = [
        ("ocpp", "0008_forwarder_defaults_and_exports"),
    ]

    operations = [
        migrations.CreateModel(
            name="CostUpdate",
            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_transaction_id",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="OCPP transaction identifier provided by the charge point.",
                        max_length=128,
                    ),
                ),
                (
                    "connector_id",
                    models.PositiveIntegerField(
                        blank=True, null=True, verbose_name="Connector ID"
                    ),
                ),
                (
                    "total_cost",
                    models.DecimalField(
                        blank=True,
                        decimal_places=3,
                        max_digits=12,
                        null=True,
                        verbose_name="Total cost",
                    ),
                ),
                ("currency", models.CharField(blank=True, default="", max_length=8)),
                ("payload", models.JSONField(blank=True, default=dict)),
                (
                    "reported_at",
                    models.DateTimeField(default=django.utils.timezone.now),
                ),
                ("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="cost_updates",
                        to="ocpp.charger",
                        verbose_name="Charger",
                    ),
                ),
                (
                    "transaction",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="cost_updates",
                        to="ocpp.transaction",
                        verbose_name="Transaction",
                    ),
                ),
            ],
            options={
                "verbose_name": "Cost Update",
                "verbose_name_plural": "Cost Updates",
                "ordering": ["-reported_at", "-created_at", "-pk"],
            },
        ),
    ]
