# Generated by Django 6.0.4 on 2026-06-06 05:39

import apps.projects.models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('companies', '0002_initial'),
        ('projects', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='FundingOpportunity',
            fields=[
                ('id', models.UUIDField(default=apps.projects.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255)),
                ('deadline', models.DateField(blank=True, null=True)),
                ('ceiling', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
                ('stage', models.CharField(choices=[('screening', 'Screening'), ('applying', 'Applying'), ('converted', 'Converted'), ('dropped', 'Dropped')], db_index=True, default='screening', max_length=20)),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('donor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='funding_opportunities', to='companies.company')),
                ('fund', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='opportunities', to='projects.projectfund')),
            ],
            options={
                'db_table': 'funding_opportunities',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['fund'], name='funding_opp_fund_id_cc5b71_idx')],
            },
        ),
        migrations.CreateModel(
            name='FundingProposal',
            fields=[
                ('id', models.UUIDField(default=apps.projects.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('title', models.CharField(max_length=255)),
                ('submitted_date', models.DateField(blank=True, null=True)),
                ('requested_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('under_review', 'Under review'), ('approved', 'Approved'), ('declined', 'Declined')], db_index=True, default='draft', max_length=20)),
                ('document', models.FileField(blank=True, null=True, upload_to='funding_proposals/')),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('fund', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='proposals', to='projects.projectfund')),
            ],
            options={
                'db_table': 'funding_proposals',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['fund'], name='funding_pro_fund_id_eaaebf_idx')],
            },
        ),
        migrations.CreateModel(
            name='FundReport',
            fields=[
                ('id', models.UUIDField(default=apps.projects.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('title', models.CharField(max_length=255)),
                ('kind', models.CharField(choices=[('narrative', 'Narrative'), ('financial', 'Financial'), ('final', 'Final')], default='narrative', max_length=20)),
                ('due_date', models.DateField(blank=True, null=True)),
                ('submitted_date', models.DateField(blank=True, null=True)),
                ('status', models.CharField(choices=[('upcoming', 'Upcoming'), ('submitted', 'Submitted'), ('overdue', 'Overdue')], db_index=True, default='upcoming', max_length=20)),
                ('document', models.FileField(blank=True, null=True, upload_to='fund_reports/')),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('fund', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reports', to='projects.projectfund')),
            ],
            options={
                'db_table': 'fund_reports',
                'ordering': ['due_date', '-created_at'],
                'indexes': [models.Index(fields=['fund'], name='fund_report_fund_id_adfaa5_idx')],
            },
        ),
        migrations.CreateModel(
            name='ProjectFundCompliance',
            fields=[
                ('id', models.UUIDField(default=apps.projects.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('title', models.CharField(max_length=255)),
                ('kind', models.CharField(choices=[('report', 'Report'), ('audit', 'Audit'), ('submission', 'Submission')], default='report', max_length=20)),
                ('due_date', models.DateField(blank=True, null=True)),
                ('status', models.CharField(choices=[('upcoming', 'Upcoming'), ('submitted', 'Submitted'), ('overdue', 'Overdue')], db_index=True, default='upcoming', max_length=20)),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('fund', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='compliance_items', to='projects.projectfund')),
            ],
            options={
                'db_table': 'project_fund_compliance',
                'ordering': ['due_date', '-created_at'],
                'indexes': [models.Index(fields=['fund'], name='project_fun_fund_id_5ff613_idx')],
            },
        ),
        migrations.CreateModel(
            name='ProjectFundTranche',
            fields=[
                ('id', models.UUIDField(default=apps.projects.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('label', models.CharField(max_length=255)),
                ('amount', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('expected_date', models.DateField(blank=True, null=True)),
                ('received_date', models.DateField(blank=True, null=True)),
                ('status', models.CharField(choices=[('scheduled', 'Scheduled'), ('received', 'Received'), ('overdue', 'Overdue'), ('cancelled', 'Cancelled')], db_index=True, default='scheduled', max_length=20)),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('fund', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tranches', to='projects.projectfund')),
            ],
            options={
                'db_table': 'project_fund_tranches',
                'ordering': ['expected_date', '-created_at'],
                'indexes': [models.Index(fields=['fund'], name='project_fun_fund_id_eefd1a_idx')],
            },
        ),
    ]
