# Generated by Django 5.2.8 on 2025-12-06 15:03

from django.db import migrations


OLD_DESCRIPTION = "EV Charger - Residential charging for a single Electric Vehicle."
NEW_DESCRIPTION = "Single vehicle residential charging"
TEMPLATE_NAME = "EV Charger"


def _update_template_description(apps, schema_editor, description, *, current=None):
    CalculatorTemplate = apps.get_model("awg", "CalculatorTemplate")
    filters = {"name": TEMPLATE_NAME}
    if current is not None:
        filters["description"] = current
    CalculatorTemplate.objects.filter(**filters).update(description=description)


def update_description(apps, schema_editor):
    _update_template_description(
        apps, schema_editor, NEW_DESCRIPTION, current=OLD_DESCRIPTION
    )


def revert_description(apps, schema_editor):
    _update_template_description(
        apps, schema_editor, OLD_DESCRIPTION, current=NEW_DESCRIPTION
    )


class Migration(migrations.Migration):

    dependencies = [
        ("awg", "0002_initial"),
    ]

    operations = [
        migrations.RunPython(update_description, revert_description),
    ]
