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

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


class Migration(migrations.Migration):

    initial = False

    dependencies = [
        ("cards", "0002_initial"),
        ("django_celery_beat", "0019_alter_periodictasks_options"),
        ("energy", "0003_initial"),
        ("ocpp", "0002_initial"),
        ("odoo", "0003_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name="clientreport",
            name="owner",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="client_reports",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="clientreportschedule",
            name="chargers",
            field=models.ManyToManyField(
                blank=True, related_name="client_report_schedules", to="ocpp.charger"
            ),
        ),
        migrations.AddField(
            model_name="clientreportschedule",
            name="created_by",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="created_client_report_schedules",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="clientreportschedule",
            name="owner",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="client_report_schedules",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="clientreportschedule",
            name="periodic_task",
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="client_report_schedule",
                to="django_celery_beat.periodictask",
            ),
        ),
        migrations.AddField(
            model_name="clientreport",
            name="schedule",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="reports",
                to="energy.clientreportschedule",
            ),
        ),
        migrations.AddField(
            model_name="customeraccount",
            name="live_subscription_product",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="live_subscription_accounts",
                to="odoo.odooproduct",
            ),
        ),
        migrations.AddField(
            model_name="customeraccount",
            name="rfids",
            field=models.ManyToManyField(
                blank=True,
                db_table="core_account_rfids",
                related_name="energy_accounts",
                to="cards.rfid",
                verbose_name="RFIDs",
            ),
        ),
        migrations.AddField(
            model_name="customeraccount",
            name="user",
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="customer_account",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddIndex(
            model_name="energytariff",
            index=models.Index(
                fields=["year", "season", "zone", "contract_type"],
                name="energy_tariff_scope_idx",
            ),
        ),
        migrations.AddConstraint(
            model_name="energytariff",
            constraint=models.UniqueConstraint(
                fields=(
                    "year",
                    "season",
                    "zone",
                    "contract_type",
                    "period",
                    "unit",
                    "start_time",
                    "end_time",
                ),
                name="uniq_energy_tariff_schedule",
            ),
        ),
        migrations.AddField(
            model_name="customeraccount",
            name="energy_tariff",
            field=models.ForeignKey(
                blank=True,
                help_text="Tariff used to convert currency balance to energy credits.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="accounts",
                to="energy.energytariff",
            ),
        ),
        migrations.AddField(
            model_name="energytransaction",
            name="account",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="energy_transactions",
                to="energy.customeraccount",
            ),
        ),
        migrations.AddField(
            model_name="energytransaction",
            name="tariff",
            field=models.ForeignKey(
                blank=True,
                help_text="Tariff in effect when the purchase occurred.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="energy_transactions",
                to="energy.energytariff",
            ),
        ),
        migrations.AddIndex(
            model_name="energytransaction",
            index=models.Index(
                fields=["account", "created_on", "direction"],
                name="energy_txn_acct_dir_idx",
            ),
        ),
    ]
