# Generated by Django 5.2.8 on 2025-11-16 15:49

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


class Migration(migrations.Migration):

    dependencies = [
        ("ocpp", "0053_chargingprofile"),
    ]

    operations = [
        migrations.CreateModel(
            name="PowerProjection",
            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)),
                (
                    "connector_id",
                    models.PositiveIntegerField(
                        default=0,
                        help_text="Connector targeted by the projection (0 for the EVCS).",
                        verbose_name="Connector ID",
                    ),
                ),
                (
                    "duration_seconds",
                    models.PositiveIntegerField(
                        blank=True, null=True, verbose_name="Duration (seconds)"
                    ),
                ),
                (
                    "charging_rate_unit",
                    models.CharField(
                        blank=True,
                        choices=[("A", "Amperes"), ("W", "Watts")],
                        default="",
                        max_length=2,
                        verbose_name="Charging rate unit",
                    ),
                ),
                (
                    "charging_schedule_periods",
                    models.JSONField(
                        blank=True,
                        default=list,
                        help_text="Composite schedule periods returned by the EVCS.",
                    ),
                ),
                (
                    "schedule_start",
                    models.DateTimeField(
                        blank=True, null=True, verbose_name="Schedule start"
                    ),
                ),
                ("status", models.CharField(blank=True, default="", max_length=32)),
                ("raw_response", models.JSONField(blank=True, default=dict)),
                ("requested_at", models.DateTimeField(auto_now_add=True)),
                ("received_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="power_projections",
                        to="ocpp.charger",
                        verbose_name="Charger",
                    ),
                ),
            ],
            options={
                "verbose_name": "Power Projection",
                "verbose_name_plural": "Power Projections",
                "ordering": ["-received_at", "-requested_at", "-pk"],
            },
        ),
    ]
