# Generated by Django 5.0.2 on 2025-07-24 14:20

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


class Migration(migrations.Migration):

    dependencies = [
        ('customers', '0004_customer_pppoe_password_customer_pppoe_username'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='customer',
            name='account_balance',
            field=models.DecimalField(decimal_places=2, default=Decimal('0.00'), help_text="Customer's account balance for advance payments", max_digits=12),
        ),
        migrations.CreateModel(
            name='CustomerBalanceTransaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('transaction_type', models.CharField(choices=[('credit', 'Credit (Payment/Top-up)'), ('debit', 'Debit (Bill Payment)'), ('refund', 'Refund'), ('adjustment', 'Manual Adjustment')], max_length=20)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('description', models.CharField(max_length=200)),
                ('reference_id', models.CharField(blank=True, help_text='Payment ID, Invoice ID, etc.', max_length=100)),
                ('balance_before', models.DecimalField(decimal_places=2, max_digits=12)),
                ('balance_after', models.DecimalField(decimal_places=2, max_digits=12)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='balance_transactions', to='customers.customer')),
                ('processed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
    ]
