# Generated by Django 6.0.4 on 2026-05-14 13:31

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


class Migration(migrations.Migration):

    dependencies = [
        ('app', '0004_alter_contribution_payment_year'),
    ]

    operations = [
        migrations.CreateModel(
            name='ContributionAllocation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('month', models.PositiveSmallIntegerField(verbose_name='Mwezi (1-12)')),
                ('year', models.PositiveSmallIntegerField(verbose_name='Mwaka')),
                ('amount', models.DecimalField(decimal_places=0, max_digits=12, verbose_name='Kiasi kilichotengwa kwa mwezi huu')),
                ('status', models.CharField(choices=[('active', 'Inatumika'), ('adjusted', 'Imerekebishwa'), ('cancelled', 'Imefutwa')], default='active', max_length=10)),
                ('allocated_at', models.DateTimeField(auto_now_add=True)),
                ('notes', models.TextField(blank=True, null=True)),
                ('allocated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='allocations_made', to=settings.AUTH_USER_MODEL)),
                ('contribution', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='allocations', to='app.contribution')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contribution_allocations', to='app.group')),
                ('member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contribution_allocations', to='app.member')),
            ],
            options={
                'verbose_name': 'Mgawanyo wa Mchango',
                'verbose_name_plural': 'Migawanyo ya Michango',
                'ordering': ['-year', '-month'],
                'indexes': [models.Index(fields=['member', 'group', 'year', 'month'], name='app_contrib_member__c9bfd9_idx'), models.Index(fields=['contribution'], name='app_contrib_contrib_94d6d4_idx'), models.Index(fields=['status'], name='app_contrib_status_b801e2_idx')],
                'unique_together': {('contribution', 'member', 'group', 'year', 'month')},
            },
        ),
    ]
