# Generated by Django 5.2.16 on 2026-08-11 23:40

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('core', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Contribution',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('reference', models.CharField(editable=False, max_length=40, unique=True)),
                ('purpose', models.CharField(choices=[('OFFERTORY', 'Offertory'), ('DONATION', 'Donation'), ('TITHE', 'Tithe'), ('MISSIONS', 'Missions'), ('WELFARE', 'Welfare'), ('PROJECT', 'Kingdom project'), ('OTHER', 'Other')], max_length=20)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=12)),
                ('currency', models.CharField(default='GHS', max_length=3)),
                ('anonymous', models.BooleanField(default=False)),
                ('note', models.CharField(blank=True, max_length=255)),
                ('provider', models.CharField(max_length=30)),
                ('provider_reference', models.CharField(blank=True, max_length=100)),
                ('authorization_url', models.URLField(blank=True)),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('PROCESSING', 'Processing'), ('SUCCESS', 'Successful'), ('FAILED', 'Failed'), ('CANCELLED', 'Cancelled'), ('REFUNDED', 'Refunded')], default='PENDING', max_length=15)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('paid_at', models.DateTimeField(blank=True, null=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('provider_payload', models.JSONField(blank=True, default=dict)),
                ('campus', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.campus')),
                ('member', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='contributions', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['status', 'created_at'], name='payments_co_status_dbc171_idx')],
            },
        ),
    ]
