# Generated by Django 4.2.29 on 2026-04-02 11:59

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('leads', '0002_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='CostSheet',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('version', models.PositiveIntegerField(default=1)),
                ('status', models.CharField(choices=[('Draft', 'Draft'), ('Submitted', 'Submitted for Approval'), ('Under_Review', 'Under Review'), ('Approved', 'Approved'), ('Rejected', 'Rejected'), ('Revised', 'Needs Revision')], default='Draft', max_length=20)),
                ('hr_cost', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('tools_cost', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('overhead_type', models.CharField(choices=[('percent', 'Percentage'), ('fixed', 'Fixed Amount')], default='percent', max_length=10)),
                ('overhead_value', models.DecimalField(decimal_places=2, default=10, max_digits=10)),
                ('overhead_cost', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('contingency_percent', models.DecimalField(decimal_places=2, default=5, max_digits=5)),
                ('contingency_cost', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('profit_percent', models.DecimalField(decimal_places=2, default=20, max_digits=5)),
                ('profit_amount', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('subtotal', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('total_with_buffer', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('total_cost', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('client_budget', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('budget_status', models.CharField(default='pending', max_length=20)),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_cost_sheets', to=settings.AUTH_USER_MODEL)),
                ('lead', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cost_sheets', to='leads.lead')),
            ],
            options={
                'ordering': ['-version'],
                'unique_together': {('lead', 'version')},
            },
        ),
        migrations.CreateModel(
            name='CostSheetTool',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('purpose', models.CharField(blank=True, max_length=300)),
                ('cost', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
                ('cost_sheet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tool_items', to='costing.costsheet')),
            ],
        ),
        migrations.CreateModel(
            name='CostSheetMember',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('project_role', models.CharField(max_length=100)),
                ('hourly_rate', models.DecimalField(decimal_places=2, max_digits=10)),
                ('estimated_hours', models.DecimalField(decimal_places=2, default=0, max_digits=8)),
                ('total_cost', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('cost_sheet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team_members', to='costing.costsheet')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'unique_together': {('cost_sheet', 'user')},
            },
        ),
    ]
