# Generated by Django 5.0.2 on 2025-08-12 21:01

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


class Migration(migrations.Migration):

    dependencies = [
        ('customers', '0010_marketingreporttemplate_marketingweeklyreport_and_more'),
        ('payments', '0005_mpesab2btransaction_mpesab2ctransaction_and_more'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='UnreconciledPayment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('transaction_id', models.CharField(max_length=50, unique=True)),
                ('phone_number', models.CharField(max_length=15)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('account_reference', models.CharField(help_text='The account number customer tried to pay to', max_length=100)),
                ('transaction_time', models.DateTimeField()),
                ('first_name', models.CharField(blank=True, max_length=50)),
                ('middle_name', models.CharField(blank=True, max_length=50)),
                ('last_name', models.CharField(blank=True, max_length=50)),
                ('reason', models.CharField(choices=[('invalid_account', 'Invalid Account Number'), ('account_not_found', 'Account Number Not Found'), ('duplicate_transaction', 'Duplicate Transaction'), ('invalid_amount', 'Invalid Amount'), ('system_error', 'System Error')], default='invalid_account', max_length=25)),
                ('status', models.CharField(choices=[('pending', 'Pending Review'), ('resolved', 'Resolved'), ('refunded', 'Refunded'), ('ignored', 'Ignored')], default='pending', max_length=10)),
                ('notes', models.TextField(blank=True, help_text='Admin notes about this unreconciled payment')),
                ('resolved_at', models.DateTimeField(blank=True, null=True)),
                ('callback_data', models.JSONField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('resolved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('resolved_customer', models.ForeignKey(blank=True, help_text='Customer this payment was eventually assigned to', null=True, on_delete=django.db.models.deletion.SET_NULL, to='customers.customer')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
    ]
