# Generated by Django 5.0.1 on 2026-07-01 18:36

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('members', '0009_taxmaster_child_marital_status_membertax_transaction'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='AccountHead',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=300, verbose_name='Account Head Name')),
                ('description', models.TextField(blank=True, default='')),
                ('head_type', models.CharField(blank=True, choices=[('Event', 'Event'), ('Recurring', 'Recurring'), ('General', 'General')], default='', max_length=20, verbose_name='Type')),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_account_heads', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Account Head',
                'verbose_name_plural': 'Account Heads',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='AccountTransaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('transaction_type', models.CharField(choices=[('INCOME', 'Income'), ('EXPENSE', 'Expense')], max_length=10)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=12)),
                ('transaction_date', models.DateField()),
                ('payment_mode', models.CharField(choices=[('Cash', 'Cash'), ('Bank Transfer', 'Bank Transfer'), ('UPI', 'UPI'), ('Cheque', 'Cheque')], max_length=20)),
                ('donor_name', models.CharField(blank=True, default='', max_length=200)),
                ('donor_contact', models.CharField(blank=True, default='', max_length=50)),
                ('purpose', models.TextField(blank=True, default='', verbose_name='Purpose / Remarks')),
                ('paid_to', models.CharField(blank=True, default='', max_length=200)),
                ('purpose_description', models.TextField(blank=True, default='')),
                ('bill_reference', models.CharField(blank=True, default='', max_length=200)),
                ('proof_document', models.FileField(blank=True, null=True, upload_to='transaction_proofs/')),
                ('is_deleted', models.BooleanField(default=False)),
                ('change_log', models.JSONField(blank=True, default=list)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('account_head', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='transactions', to='accounting.accounthead')),
                ('entered_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='entered_transactions', to=settings.AUTH_USER_MODEL)),
                ('member', models.ForeignKey(blank=True, help_text='Link to registered member if the donor is a member.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='donation_transactions', to='members.member')),
            ],
            options={
                'verbose_name': 'Account Transaction',
                'verbose_name_plural': 'Account Transactions',
                'ordering': ['-transaction_date', '-created_at'],
            },
        ),
        migrations.CreateModel(
            name='Receipt',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('receipt_number', models.CharField(editable=False, max_length=30, unique=True)),
                ('generated_at', models.DateTimeField(auto_now_add=True)),
                ('pdf_file', models.FileField(blank=True, null=True, upload_to='receipts/')),
                ('transaction', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='receipt', to='accounting.accounttransaction')),
            ],
            options={
                'verbose_name': 'Receipt',
                'verbose_name_plural': 'Receipts',
                'ordering': ['-generated_at'],
            },
        ),
        migrations.CreateModel(
            name='StaffProfile',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='Full Name')),
                ('phone', models.CharField(max_length=15, unique=True, verbose_name='Phone Number')),
                ('role', models.CharField(choices=[('ACCOUNTANT', 'Accountant')], default='ACCOUNTANT', max_length=20)),
                ('is_active', models.BooleanField(default=True, verbose_name='Active')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='staff_profile', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Staff Profile',
                'verbose_name_plural': 'Staff Profiles',
            },
        ),
    ]
