# Generated by Django 5.2.19 on 2026-11-30 15:33

import django.core.serializers.json
import django.db.models.deletion
import uuid
from decimal import Decimal
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('accounting', '0010_voucherregisterviewconfig_and_more'),
        ('banking', '0001_initial'),
        ('budgeting', '0001_initial'),
        ('inventory', '0002_initial'),
        ('loans', '0001_initial'),
        ('party_hub', '0001_initial'),
        ('projects', '0001_initial'),
        ('tenancy', '0003_taxconfig_calculation_rule_taxconfig_category_and_more'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='DailySiteReport',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('report_date', models.DateField(db_index=True)),
                ('bs_date', models.CharField(blank=True, max_length=16)),
                ('weather', models.CharField(blank=True, max_length=80)),
                ('work_performed', models.TextField()),
                ('quantity_completed', models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=14)),
                ('skilled_workers', models.PositiveIntegerField(default=0)),
                ('unskilled_workers', models.PositiveIntegerField(default=0)),
                ('equipment_utilized', models.JSONField(blank=True, default=list, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('materials_consumed', models.JSONField(blank=True, default=list, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('delays', models.CharField(blank=True, max_length=255)),
                ('safety_observations', models.TextField(blank=True)),
                ('quality_observations', models.TextField(blank=True)),
                ('photographs', models.JSONField(blank=True, default=list, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('idempotency_key', models.CharField(blank=True, max_length=128, null=True)),
                ('status', models.CharField(choices=[('DRAFT', 'Draft'), ('SUBMITTED', 'Submitted'), ('APPROVED', 'Approved')], default='SUBMITTED', max_length=16)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_daily_reports',
                'ordering': ['-report_date', '-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectActivity',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('code', models.CharField(max_length=40)),
                ('name', models.CharField(max_length=200)),
                ('unit', models.CharField(default='Units', max_length=24)),
                ('planned_qty', models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=14)),
                ('completed_qty', models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=14)),
                ('progress_pct', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=5)),
                ('daily_production_target', models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=12)),
                ('planned_start', models.DateField(blank=True, null=True)),
                ('planned_end', models.DateField(blank=True, null=True)),
                ('actual_start', models.DateField(blank=True, null=True)),
                ('actual_end', models.DateField(blank=True, null=True)),
                ('delay_days', models.IntegerField(default=0)),
                ('delay_reason', models.CharField(blank=True, max_length=255)),
                ('status', models.CharField(default='PLANNED', max_length=16)),
            ],
            options={
                'db_table': 'project_activities',
                'ordering': ['planned_start', 'code'],
            },
        ),
        migrations.CreateModel(
            name='ProjectAdvance',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('direction', models.CharField(choices=[('CLIENT_RECEIVED', 'Client Mobilization Advance (Liability)'), ('CONTRACTOR_PAID', 'Contractor Mobilization Advance (Asset)')], default='CLIENT_RECEIVED', max_length=20)),
                ('permitted_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('approved_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('disbursed_received_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('recovered_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('recovery_rate_pct', models.DecimalField(decimal_places=2, default=Decimal('10.00'), max_digits=5)),
                ('bank_guarantee_ref', models.CharField(blank=True, max_length=80)),
                ('bank_guarantee_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('guarantee_expiry_date', models.DateField(blank=True, null=True)),
                ('settlement_date', models.DateField(blank=True, null=True)),
                ('recovery_schedule', models.JSONField(blank=True, default=list, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_advances',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectApproval',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('entity_type', models.CharField(max_length=40)),
                ('entity_id', models.CharField(max_length=64)),
                ('action', models.CharField(max_length=24)),
                ('comment', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_approvals',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectAuditLog',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('action', models.CharField(max_length=64)),
                ('entity_type', models.CharField(max_length=48)),
                ('entity_id', models.CharField(max_length=64)),
                ('previous_state', models.JSONField(blank=True, encoder=django.core.serializers.json.DjangoJSONEncoder, null=True)),
                ('new_state', models.JSONField(blank=True, encoder=django.core.serializers.json.DjangoJSONEncoder, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_audit_logs',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectBoqHeader',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('boq_no', models.CharField(max_length=48)),
                ('title', models.CharField(max_length=200)),
                ('version', models.PositiveSmallIntegerField(default=1)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_boqs',
                'ordering': ['-version', 'boq_no'],
            },
        ),
        migrations.CreateModel(
            name='ProjectBoqLine',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('item_code', models.CharField(max_length=40)),
                ('description', models.CharField(max_length=255)),
                ('unit', models.CharField(default='Cum', max_length=24)),
                ('contract_qty', models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=18)),
                ('contract_rate', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('revised_qty', models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=18)),
                ('revised_rate', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('completed_qty', models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=18)),
                ('previous_certified_qty', models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=18)),
                ('current_measured_qty', models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=18)),
            ],
            options={
                'db_table': 'project_boq_items',
                'ordering': ['item_code'],
            },
        ),
        migrations.CreateModel(
            name='ProjectBudget',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('original_ceiling', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('approved_ceiling', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('estimated_cost_to_complete', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('current_version_no', models.PositiveSmallIntegerField(default=1)),
                ('status', models.CharField(default='APPROVED', max_length=16)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_budgets',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectBudgetVersion',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('version_no', models.PositiveSmallIntegerField(default=1)),
                ('ceiling_amount', models.DecimalField(decimal_places=2, max_digits=18)),
                ('reason', models.CharField(max_length=255)),
                ('breakdown', models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_budget_versions',
                'ordering': ['-version_no'],
            },
        ),
        migrations.CreateModel(
            name='ProjectClient',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('organization_name', models.CharField(max_length=200)),
                ('client_code', models.CharField(blank=True, max_length=40)),
                ('pan_vat_no', models.CharField(blank=True, max_length=20)),
                ('contact_person', models.CharField(blank=True, max_length=120)),
                ('telephone', models.CharField(blank=True, max_length=40)),
                ('email', models.EmailField(blank=True, max_length=254)),
                ('address', models.CharField(blank=True, max_length=255)),
                ('is_primary', models.BooleanField(default=True)),
            ],
            options={
                'db_table': 'project_clients',
                'ordering': ['-is_primary', 'organization_name'],
            },
        ),
        migrations.CreateModel(
            name='ProjectContract',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('contract_no', models.CharField(max_length=80)),
                ('original_contract_value', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('approved_contract_value', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('approved_cost_budget', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('retention_rate', models.DecimalField(decimal_places=2, default=Decimal('5.00'), max_digits=5)),
                ('retention_ceiling', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('retention_on_vat', models.BooleanField(default=False)),
                ('mobilization_advance_permitted', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('mobilization_advance_received', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('advance_recovery_rate', models.DecimalField(decimal_places=2, default=Decimal('10.00'), max_digits=5)),
                ('advance_guarantee_ref', models.CharField(blank=True, max_length=80)),
                ('performance_guarantee_ref', models.CharField(blank=True, max_length=80)),
                ('insurance_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('insurance_policy_no', models.CharField(blank=True, max_length=80)),
                ('insurance_expiry_date', models.DateField(blank=True, null=True)),
                ('liquidated_damages_rate_pct', models.DecimalField(decimal_places=3, default=Decimal('0.050'), max_digits=6)),
                ('liquidated_damages_cap_pct', models.DecimalField(decimal_places=2, default=Decimal('10.00'), max_digits=5)),
                ('price_escalation_enabled', models.BooleanField(default=False)),
                ('price_escalation_formula', models.CharField(blank=True, max_length=255)),
                ('tax_treatment', models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('payment_terms', models.CharField(default='Monthly Interim Payment Certificate (30 Days)', max_length=255)),
                ('contract_conditions', models.TextField(blank=True)),
                ('clauses', models.JSONField(blank=True, default=list, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('is_closed', models.BooleanField(default=False)),
                ('version', models.PositiveIntegerField(default=1)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'project_contracts',
            },
        ),
        migrations.CreateModel(
            name='ProjectContractAmendment',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('amendment_no', models.CharField(max_length=48)),
                ('version', models.PositiveIntegerField(default=1)),
                ('previous_approved_value', models.DecimalField(decimal_places=2, max_digits=18)),
                ('new_approved_value', models.DecimalField(decimal_places=2, max_digits=18)),
                ('time_extension_days', models.IntegerField(default=0)),
                ('summary', models.CharField(max_length=255)),
                ('approved_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_contract_amendments',
                'ordering': ['-version', '-approved_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectCostAllocation',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('source_type', models.CharField(max_length=32)),
                ('source_ref', models.CharField(max_length=80)),
                ('description', models.CharField(blank=True, max_length=255)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=18)),
                ('posting_date', models.DateField(db_index=True)),
                ('bs_date', models.CharField(blank=True, max_length=16)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_cost_allocations',
                'ordering': ['-posting_date', '-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectDocument',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('category', models.CharField(choices=[('CONTRACT_AGREEMENT', 'Contract Agreement'), ('LETTER_OF_AWARD', 'Letter of Award'), ('BOQ', 'Bill of Quantities (BOQ)'), ('APPROVED_DRAWINGS', 'Approved Drawings'), ('DESIGN_DOCUMENTS', 'Design Documents'), ('INSURANCE_CERTIFICATES', 'Insurance Certificates'), ('PERFORMANCE_GUARANTEES', 'Performance Guarantees'), ('ADVANCE_GUARANTEES', 'Advance Guarantees'), ('WORK_PROGRAM', 'Work Program'), ('VARIATION_ORDERS', 'Variation Orders'), ('MEASUREMENT_BOOKS', 'Measurement Books'), ('RA_BILLS', 'RA Bills'), ('SITE_INSTRUCTIONS', 'Site Instructions'), ('INSPECTION_REPORTS', 'Inspection Reports'), ('COMPLETION_CERTIFICATES', 'Completion Certificates'), ('HANDOVER_DOCUMENTS', 'Handover Documents'), ('FINAL_SETTLEMENT', 'Final Settlement Statements')], max_length=32)),
                ('title', models.CharField(max_length=200)),
                ('file_name', models.CharField(max_length=200)),
                ('storage_key', models.CharField(blank=True, max_length=255)),
                ('mime_type', models.CharField(blank=True, max_length=120)),
                ('file_size_bytes', models.PositiveIntegerField(default=0)),
                ('sha256_hash', models.CharField(blank=True, max_length=64)),
                ('version', models.PositiveIntegerField(default=1)),
                ('expiry_date', models.DateField(blank=True, null=True)),
                ('is_restricted', models.BooleanField(default=False)),
                ('approval_status', models.CharField(default='APPROVED', max_length=16)),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_documents',
                'ordering': ['-uploaded_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectGuarantee',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('guarantee_type', models.CharField(choices=[('BID_BOND', 'Bid Bond'), ('PERFORMANCE', 'Performance Guarantee'), ('ADVANCE_PAYMENT', 'Advance Payment Guarantee'), ('RETENTION_MONEY', 'Retention Money Guarantee')], max_length=24)),
                ('guarantee_number', models.CharField(max_length=64)),
                ('issuing_bank', models.CharField(max_length=160)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=18)),
                ('issue_date', models.DateField()),
                ('expiry_date', models.DateField()),
                ('claim_expiry_date', models.DateField(blank=True, null=True)),
                ('status', models.CharField(default='ACTIVE', max_length=20)),
            ],
            options={
                'db_table': 'project_guarantees',
                'ordering': ['-issue_date'],
            },
        ),
        migrations.CreateModel(
            name='ProjectLocation',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('country', models.CharField(default='Nepal', max_length=64)),
                ('province', models.CharField(blank=True, max_length=64)),
                ('district', models.CharField(blank=True, max_length=64)),
                ('local_level_type', models.CharField(blank=True, max_length=40)),
                ('municipality', models.CharField(blank=True, max_length=120)),
                ('ward_no', models.CharField(blank=True, max_length=20)),
                ('address', models.CharField(blank=True, max_length=255)),
                ('gps_latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
                ('gps_longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
                ('site_area', models.CharField(blank=True, max_length=80)),
                ('access_route', models.CharField(blank=True, max_length=255)),
                ('is_primary', models.BooleanField(default=False)),
            ],
            options={
                'db_table': 'project_locations',
                'ordering': ['-is_primary', 'province', 'district'],
            },
        ),
        migrations.CreateModel(
            name='ProjectMilestone',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('milestone_kind', models.CharField(choices=[('CONTRACT_SIGNING', 'Contract Signing'), ('ADVANCE_PAYMENT', 'Advance Payment'), ('SITE_HANDOVER', 'Site Handover'), ('MOBILIZATION', 'Mobilization'), ('COMMENCEMENT', 'Commencement'), ('FOUNDATION', 'Foundation Completion'), ('STRUCTURAL', 'Structural Completion'), ('DELIVERY', 'Major Delivery Milestone'), ('TESTING_COMMISSIONING', 'Testing & Commissioning'), ('PRACTICAL_COMPLETION', 'Practical Completion'), ('FINAL_HANDOVER', 'Final Handover'), ('DEFECTS_LIABILITY', 'Defects Liability Completion'), ('FINAL_SETTLEMENT', 'Final Account Settlement')], default='DELIVERY', max_length=28)),
                ('title', models.CharField(max_length=160)),
                ('planned_date', models.DateField(blank=True, null=True)),
                ('revised_date', models.DateField(blank=True, null=True)),
                ('actual_date', models.DateField(blank=True, null=True)),
                ('completion_pct', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=5)),
                ('evidence_ref', models.CharField(blank=True, max_length=255)),
                ('approval_status', models.CharField(choices=[('PENDING', 'Pending'), ('IN_PROGRESS', 'In Progress'), ('SUBMITTED', 'Submitted for Approval'), ('APPROVED', 'Approved / Completed')], default='PENDING', max_length=16)),
                ('sequence', models.PositiveSmallIntegerField(default=1)),
            ],
            options={
                'db_table': 'project_milestones',
                'ordering': ['sequence', 'planned_date'],
            },
        ),
        migrations.CreateModel(
            name='ProjectProgress',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('period_label', models.CharField(max_length=40)),
                ('report_date', models.DateField(db_index=True)),
                ('bs_date', models.CharField(blank=True, max_length=16)),
                ('planned_progress_pct', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=5)),
                ('actual_progress_pct', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=5)),
                ('measured_qty', models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=14)),
                ('remarks', models.CharField(blank=True, max_length=255)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_progress',
                'ordering': ['report_date', 'created_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectRetention',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('direction', models.CharField(choices=[('RECEIVABLE', 'Client Retention Receivable'), ('PAYABLE', 'Contractor Retention Payable')], default='RECEIVABLE', max_length=16)),
                ('retention_rate', models.DecimalField(decimal_places=2, default=Decimal('5.00'), max_digits=5)),
                ('retention_ceiling', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('eligible_certified_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('deducted_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('released_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('release_milestone', models.CharField(default='Practical Completion & DLP Expiry', max_length=160)),
                ('defects_liability_months', models.PositiveSmallIntegerField(default=12)),
                ('expected_release_date', models.DateField(blank=True, null=True)),
                ('actual_release_date', models.DateField(blank=True, null=True)),
                ('is_disputed', models.BooleanField(default=False)),
                ('dispute_notes', models.CharField(blank=True, max_length=255)),
                ('document_ref', models.CharField(blank=True, max_length=160)),
                ('status', models.CharField(choices=[('HELD', 'Held'), ('PARTIAL', 'Partially Released'), ('RELEASED', 'Fully Released'), ('DISPUTED', 'Disputed')], default='HELD', max_length=16)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_retention',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectTeamMember',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('project_role', models.CharField(choices=[('PROJECT_DIRECTOR', 'Project Director'), ('PROJECT_MANAGER', 'Project Manager'), ('PROJECT_ENGINEER', 'Project Engineer'), ('SITE_ENGINEER', 'Site Engineer'), ('SITE_SUPERVISOR', 'Site Supervisor'), ('PROJECT_ACCOUNTANT', 'Project Accountant'), ('QUANTITY_SURVEYOR', 'Quantity Surveyor'), ('PROCUREMENT_OFFICER', 'Procurement Officer'), ('STOREKEEPER', 'Storekeeper'), ('SAFETY_OFFICER', 'Safety Officer'), ('QUALITY_ENGINEER', 'Quality Engineer')], max_length=28)),
                ('responsibility_notes', models.CharField(blank=True, max_length=255)),
                ('can_approve_dsr', models.BooleanField(default=False)),
                ('can_approve_variations', models.BooleanField(default=False)),
                ('can_manage_store', models.BooleanField(default=False)),
                ('is_active', models.BooleanField(default=True)),
                ('assigned_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_team_members',
                'ordering': ['project_role', 'user__username'],
            },
        ),
        migrations.CreateModel(
            name='ProjectVariationOrder',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('variation_no', models.CharField(max_length=48)),
                ('contract_ref', models.CharField(blank=True, max_length=80)),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True)),
                ('reason', models.CharField(blank=True, max_length=255)),
                ('boq_changes', models.JSONField(blank=True, default=list, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('additional_value', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('reduction_value', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('time_extension_days', models.IntegerField(default=0)),
                ('cost_budget_impact', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18)),
                ('status', models.CharField(choices=[('DRAFT', 'Draft'), ('SUBMITTED', 'Pending Client Approval'), ('APPROVED', 'Approved'), ('REJECTED', 'Rejected')], db_index=True, default='DRAFT', max_length=16)),
                ('client_approval_ref', models.CharField(blank=True, max_length=80)),
                ('contract_amendment_no', models.CharField(blank=True, max_length=48)),
                ('supporting_doc_ref', models.CharField(blank=True, max_length=255)),
                ('approved_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_variations',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ProjectWbsNode',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('code', models.CharField(max_length=40)),
                ('name', models.CharField(max_length=180)),
                ('level_type', models.CharField(default='PACKAGE', max_length=24)),
                ('planned_weight_pct', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=5)),
            ],
            options={
                'db_table': 'project_wbs',
                'ordering': ['code'],
            },
        ),
        migrations.CreateModel(
            name='SiteInspectionSafetyLog',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('log_kind', models.CharField(choices=[('QUALITY_INSPECTION', 'Quality Inspection'), ('SAFETY_INCIDENT', 'Safety Observation / Incident')], max_length=24)),
                ('log_date', models.DateField()),
                ('bs_date', models.CharField(blank=True, max_length=16)),
                ('title', models.CharField(max_length=200)),
                ('severity_or_result', models.CharField(default='PASS', max_length=32)),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'project_site_qa_hse',
                'ordering': ['-log_date', '-created_at'],
            },
        ),
        migrations.AddField(
            model_name='project',
            name='activated_at',
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='project',
            name='actual_end_date',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='project',
            name='actual_start_date',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='project',
            name='approved_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_projects', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='project',
            name='approved_contract_value',
            field=models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18),
        ),
        migrations.AddField(
            model_name='project',
            name='award_date',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='project',
            name='client_party',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='client_projects', to='accounting.party'),
        ),
        migrations.AddField(
            model_name='project',
            name='consultant_engineer',
            field=models.CharField(blank=True, max_length=160),
        ),
        migrations.AddField(
            model_name='project',
            name='consultant_name',
            field=models.CharField(blank=True, max_length=200),
        ),
        migrations.AddField(
            model_name='project',
            name='contract_reference',
            field=models.CharField(blank=True, db_index=True, max_length=80),
        ),
        migrations.AddField(
            model_name='project',
            name='contract_signing_date',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='project',
            name='contract_type',
            field=models.CharField(choices=[('LUMP_SUM', 'Lump Sum'), ('ITEM_RATE', 'Item Rate'), ('UNIT_RATE', 'Unit Rate'), ('EPC', 'EPC'), ('DESIGN_BUILD', 'Design-Build'), ('COST_PLUS', 'Cost Plus')], default='ITEM_RATE', max_length=24),
        ),
        migrations.AddField(
            model_name='project',
            name='created_at',
            field=models.DateTimeField(auto_now_add=True, null=True),
        ),
        migrations.AddField(
            model_name='project',
            name='created_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_projects', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='project',
            name='currency',
            field=models.CharField(default='NPR', max_length=3),
        ),
        migrations.AddField(
            model_name='project',
            name='defects_liability_end_date',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='project',
            name='defects_liability_months',
            field=models.PositiveSmallIntegerField(default=12),
        ),
        migrations.AddField(
            model_name='project',
            name='description',
            field=models.TextField(blank=True),
        ),
        migrations.AddField(
            model_name='project',
            name='fiscal_year',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='projects', to='tenancy.fiscalyear'),
        ),
        migrations.AddField(
            model_name='project',
            name='is_draft',
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name='project',
            name='jv_partners',
            field=models.CharField(blank=True, max_length=255),
        ),
        migrations.AddField(
            model_name='project',
            name='main_contractor',
            field=models.CharField(blank=True, max_length=200),
        ),
        migrations.AddField(
            model_name='project',
            name='mobilization_advance_permitted',
            field=models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18),
        ),
        migrations.AddField(
            model_name='project',
            name='procurement_method',
            field=models.CharField(choices=[('OPEN_TENDER', 'Open Tender'), ('LIMITED_TENDER', 'Limited Tender'), ('DIRECT_PROCUREMENT', 'Direct Procurement'), ('NEGOTIATED', 'Negotiated')], default='OPEN_TENDER', max_length=24),
        ),
        migrations.AddField(
            model_name='project',
            name='project_accountant',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='accounted_projects', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='project',
            name='project_classification',
            field=models.CharField(choices=[('INFRASTRUCTURE', 'Infrastructure'), ('BUILDING', 'Building'), ('ROAD', 'Road'), ('BRIDGE', 'Bridge'), ('HYDROPOWER', 'Hydropower'), ('IRRIGATION', 'Irrigation'), ('CIVIL_WORKS', 'Civil Works')], default='CIVIL_WORKS', max_length=24),
        ),
        migrations.AddField(
            model_name='project',
            name='project_manager',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='managed_projects', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='project',
            name='registration_step',
            field=models.PositiveSmallIntegerField(default=1),
        ),
        migrations.AddField(
            model_name='project',
            name='retention_ceiling',
            field=models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=18),
        ),
        migrations.AddField(
            model_name='project',
            name='retention_rate',
            field=models.DecimalField(decimal_places=2, default=Decimal('5.00'), max_digits=5),
        ),
        migrations.AddField(
            model_name='project',
            name='revised_end_date',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='project',
            name='site_engineer',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='engineered_projects', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='project',
            name='theme_code',
            field=models.CharField(default='CONSTRUCTION_TEAL', max_length=24),
        ),
        migrations.AddField(
            model_name='project',
            name='updated_at',
            field=models.DateTimeField(auto_now=True, null=True),
        ),
        migrations.AddField(
            model_name='site',
            name='actual_completion_date',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='site',
            name='district',
            field=models.CharField(blank=True, max_length=64),
        ),
        migrations.AddField(
            model_name='site',
            name='expected_completion_date',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='site',
            name='gps_latitude',
            field=models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True),
        ),
        migrations.AddField(
            model_name='site',
            name='gps_longitude',
            field=models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True),
        ),
        migrations.AddField(
            model_name='site',
            name='municipality',
            field=models.CharField(blank=True, max_length=120),
        ),
        migrations.AddField(
            model_name='site',
            name='province',
            field=models.CharField(blank=True, max_length=64),
        ),
        migrations.AddField(
            model_name='site',
            name='site_accountant',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='accounted_sites', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='site',
            name='site_cash_account',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='linked_sites', to='banking.cashaccount'),
        ),
        migrations.AddField(
            model_name='site',
            name='site_cost_center',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='linked_sites', to='accounting.costcenter'),
        ),
        migrations.AddField(
            model_name='site',
            name='site_engineer',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='engineered_sites', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='site',
            name='site_manager',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='managed_sites', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='site',
            name='site_store',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='linked_sites', to='inventory.warehouse'),
        ),
        migrations.AddField(
            model_name='site',
            name='site_supervisor',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='supervised_sites', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='site',
            name='site_type',
            field=models.CharField(choices=[('MAIN', 'Main Worksite'), ('TEMPORARY', 'Temporary Site / Camp'), ('REMOTE', 'Remote Site'), ('SECTION', 'Chainage / Section')], default='MAIN', max_length=16),
        ),
        migrations.AddField(
            model_name='site',
            name='start_date',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='site',
            name='status',
            field=models.CharField(choices=[('PLANNED', 'Planned'), ('ACTIVE', 'Active'), ('SUSPENDED', 'Suspended'), ('COMPLETED', 'Completed')], default='ACTIVE', max_length=16),
        ),
        migrations.AddField(
            model_name='site',
            name='ward_no',
            field=models.CharField(blank=True, max_length=20),
        ),
        migrations.AlterField(
            model_name='project',
            name='code',
            field=models.CharField(db_index=True, max_length=32),
        ),
        migrations.AlterField(
            model_name='project',
            name='status',
            field=models.CharField(choices=[('DRAFT', 'Draft'), ('PLANNED', 'Planning'), ('AWARDED', 'Awarded'), ('ACTIVE', 'Active'), ('SUSPENDED', 'Suspended'), ('ON_HOLD', 'On Hold'), ('COMPLETED', 'Completed'), ('CLOSED', 'Closed')], db_index=True, default='ACTIVE', max_length=16),
        ),
        migrations.AddIndex(
            model_name='project',
            index=models.Index(fields=['company', 'status'], name='idx_prj_cmp_stat'),
        ),
        migrations.AddField(
            model_name='dailysitereport',
            name='approved_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='approved_dsrs', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='dailysitereport',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='dailysitereport',
            name='prepared_by',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='prepared_dsrs', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='dailysitereport',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='daily_reports', to='projects.project'),
        ),
        migrations.AddField(
            model_name='dailysitereport',
            name='site',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='daily_reports', to='projects.site'),
        ),
        migrations.AddField(
            model_name='projectactivity',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectactivity',
            name='predecessor',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='successors', to='projects.projectactivity'),
        ),
        migrations.AddField(
            model_name='projectactivity',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectactivity',
            name='site',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='activities', to='projects.site'),
        ),
        migrations.AddField(
            model_name='dailysitereport',
            name='activity',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='projects.projectactivity'),
        ),
        migrations.AddField(
            model_name='projectadvance',
            name='advance_record',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounting.advancerecord'),
        ),
        migrations.AddField(
            model_name='projectadvance',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectadvance',
            name='party',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='accounting.party'),
        ),
        migrations.AddField(
            model_name='projectadvance',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='mobilization_advances', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectapproval',
            name='actor',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='projectapproval',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectapproval',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='approvals', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectauditlog',
            name='actor',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='projectauditlog',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectauditlog',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='audit_logs', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectboqheader',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectboqheader',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='boq_headers', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectboqline',
            name='boq_header',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='projects.projectboqheader'),
        ),
        migrations.AddField(
            model_name='projectboqline',
            name='boq_item',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='project_boq_lines', to='accounting.boqitem'),
        ),
        migrations.AddField(
            model_name='projectboqline',
            name='cost_code',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='projects.costcode'),
        ),
        migrations.AddField(
            model_name='projectboqline',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='project_boq_items', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectboqline',
            name='work_package',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounting.workpackage'),
        ),
        migrations.AddField(
            model_name='projectactivity',
            name='boq_line',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='activities', to='projects.projectboqline'),
        ),
        migrations.AddField(
            model_name='dailysitereport',
            name='boq_line',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='projects.projectboqline'),
        ),
        migrations.AddField(
            model_name='projectbudget',
            name='budget',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='budgeting.budget'),
        ),
        migrations.AddField(
            model_name='projectbudget',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectbudget',
            name='fiscal_year',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='tenancy.fiscalyear'),
        ),
        migrations.AddField(
            model_name='projectbudget',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='project_budgets', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectbudgetversion',
            name='approved_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='projectbudgetversion',
            name='project_budget',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='versions', to='projects.projectbudget'),
        ),
        migrations.AddField(
            model_name='projectclient',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectclient',
            name='party',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='accounting.party'),
        ),
        migrations.AddField(
            model_name='projectclient',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='clients', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectcontract',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectcontract',
            name='project',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='contract', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectcontractamendment',
            name='approved_by',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='projectcontractamendment',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectcontractamendment',
            name='contract',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amendments', to='projects.projectcontract'),
        ),
        migrations.AddField(
            model_name='projectcostallocation',
            name='boq_item',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounting.boqitem'),
        ),
        migrations.AddField(
            model_name='projectcostallocation',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectcostallocation',
            name='cost_code',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='projects.costcode'),
        ),
        migrations.AddField(
            model_name='projectcostallocation',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cost_allocations', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectcostallocation',
            name='site',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='projects.site'),
        ),
        migrations.AddField(
            model_name='projectcostallocation',
            name='voucher',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounting.voucher'),
        ),
        migrations.AddField(
            model_name='projectdocument',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectdocument',
            name='linked_voucher',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='project_documents', to='accounting.voucher'),
        ),
        migrations.AddField(
            model_name='projectdocument',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='project_documents', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectdocument',
            name='site',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='site_documents', to='projects.site'),
        ),
        migrations.AddField(
            model_name='projectdocument',
            name='uploaded_by',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='projectguarantee',
            name='bank_guarantee',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='loans.bankguarantee'),
        ),
        migrations.AddField(
            model_name='projectguarantee',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectguarantee',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='project_guarantees', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectlocation',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectlocation',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='locations', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectmilestone',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectmilestone',
            name='owner',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='projectmilestone',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='milestones', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectprogress',
            name='activity',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='projects.projectactivity'),
        ),
        migrations.AddField(
            model_name='projectprogress',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectprogress',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='progress_records', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectprogress',
            name='recorded_by',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='projectprogress',
            name='site',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='projects.site'),
        ),
        migrations.AddField(
            model_name='projectretention',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectretention',
            name='party',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='accounting.party'),
        ),
        migrations.AddField(
            model_name='projectretention',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='retention_records', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectretention',
            name='retention_schedule',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='party_hub.retentionschedule'),
        ),
        migrations.AddField(
            model_name='projectteammember',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectteammember',
            name='department',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounting.department'),
        ),
        migrations.AddField(
            model_name='projectteammember',
            name='employee',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounting.employeeprofile'),
        ),
        migrations.AddField(
            model_name='projectteammember',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team_members', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectteammember',
            name='site',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team_members', to='projects.site'),
        ),
        migrations.AddField(
            model_name='projectteammember',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='project_assignments', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='projectvariationorder',
            name='approved_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='approved_variations', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='projectvariationorder',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectvariationorder',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='variations', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectvariationorder',
            name='submitted_by',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='submitted_variations', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='projectwbsnode',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='projectwbsnode',
            name='parent',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='projects.projectwbsnode'),
        ),
        migrations.AddField(
            model_name='projectwbsnode',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='wbs_nodes', to='projects.project'),
        ),
        migrations.AddField(
            model_name='projectwbsnode',
            name='work_package',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounting.workpackage'),
        ),
        migrations.AddField(
            model_name='projectactivity',
            name='wbs_node',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='activities', to='projects.projectwbsnode'),
        ),
        migrations.AddField(
            model_name='siteinspectionsafetylog',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.company'),
        ),
        migrations.AddField(
            model_name='siteinspectionsafetylog',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='qa_hse_logs', to='projects.project'),
        ),
        migrations.AddField(
            model_name='siteinspectionsafetylog',
            name='recorded_by',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='siteinspectionsafetylog',
            name='site',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='qa_hse_logs', to='projects.site'),
        ),
        migrations.AlterUniqueTogether(
            name='projectboqheader',
            unique_together={('project', 'boq_no')},
        ),
        migrations.AddConstraint(
            model_name='dailysitereport',
            constraint=models.UniqueConstraint(fields=('company', 'idempotency_key'), name='uniq_dsr_cmp_idem'),
        ),
        migrations.AlterUniqueTogether(
            name='projectteammember',
            unique_together={('project', 'user', 'project_role', 'site')},
        ),
        migrations.AlterUniqueTogether(
            name='projectvariationorder',
            unique_together={('project', 'variation_no')},
        ),
        migrations.AlterUniqueTogether(
            name='projectwbsnode',
            unique_together={('project', 'code')},
        ),
        migrations.AlterUniqueTogether(
            name='projectactivity',
            unique_together={('project', 'code')},
        ),
    ]
