# Generated by Django 6.0.1 on 2026-05-11 20:32

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('complaints', '0003_initial'),
        ('observations', '0001_initial'),
        ('organizations', '0004_legacylocation_legacymainsection_and_more'),
        ('px_sources', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='observation',
            name='px_source',
            field=models.ForeignKey(blank=True, help_text='Source of observation', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='observations', to='px_sources.pxsource'),
        ),
        migrations.AddField(
            model_name='observation',
            name='resolved_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='resolved_observations', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='observation',
            name='staff',
            field=models.ForeignKey(blank=True, help_text='Staff member mentioned in observation', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observations', to='organizations.staff'),
        ),
        migrations.AddField(
            model_name='observation',
            name='subsection',
            field=models.ForeignKey(blank=True, help_text='Specific subsection', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observations', to='organizations.legacysubsection'),
        ),
        migrations.AddField(
            model_name='observation',
            name='taxonomy_category',
            field=models.ForeignKey(blank=True, help_text='Level 2: Category', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observations_category', to='complaints.complaintcategory'),
        ),
        migrations.AddField(
            model_name='observation',
            name='taxonomy_classification',
            field=models.ForeignKey(blank=True, help_text='Level 4: Classification', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observations_classification', to='complaints.complaintcategory'),
        ),
        migrations.AddField(
            model_name='observation',
            name='taxonomy_domain',
            field=models.ForeignKey(blank=True, help_text='Level 1: Domain', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observations_domain', to='complaints.complaintcategory'),
        ),
        migrations.AddField(
            model_name='observation',
            name='taxonomy_subcategory',
            field=models.ForeignKey(blank=True, help_text='Level 3: Subcategory', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observations_subcategory', to='complaints.complaintcategory'),
        ),
        migrations.AddField(
            model_name='observation',
            name='triaged_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='triaged_observations', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='observationattachment',
            name='observation',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='observations.observation'),
        ),
        migrations.AddField(
            model_name='observation',
            name='category',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observations', to='observations.observationcategory'),
        ),
        migrations.AddField(
            model_name='observationnote',
            name='created_by',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_notes', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='observationnote',
            name='observation',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='observations.observation'),
        ),
        migrations.AddField(
            model_name='observationslaconfig',
            name='hospital',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='observation_sla_configs', to='organizations.hospital'),
        ),
        migrations.AddField(
            model_name='observationstatuslog',
            name='changed_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_status_changes', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='observationstatuslog',
            name='observation',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='status_logs', to='observations.observation'),
        ),
        migrations.AddField(
            model_name='observationsubcategory',
            name='category',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sub_categories', to='observations.observationcategory'),
        ),
        migrations.AddField(
            model_name='observation',
            name='sub_category',
            field=models.ForeignKey(blank=True, help_text='Observation sub-category for finer classification', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observations', to='observations.observationsubcategory'),
        ),
        migrations.AddIndex(
            model_name='observationslaconfig',
            index=models.Index(fields=['hospital', 'is_active'], name='observation_hospita_5228b0_idx'),
        ),
        migrations.AddIndex(
            model_name='observationslaconfig',
            index=models.Index(fields=['hospital', 'severity', 'is_active'], name='observation_hospita_2cd15a_idx'),
        ),
        migrations.AddIndex(
            model_name='observation',
            index=models.Index(fields=['hospital', 'status', '-created_at'], name='observation_hospita_dcd21a_idx'),
        ),
        migrations.AddIndex(
            model_name='observation',
            index=models.Index(fields=['severity', '-created_at'], name='observation_severit_ba73c0_idx'),
        ),
        migrations.AddIndex(
            model_name='observation',
            index=models.Index(fields=['assigned_department', 'status'], name='observation_assigne_33edad_idx'),
        ),
        migrations.AddIndex(
            model_name='observation',
            index=models.Index(fields=['assigned_to', 'status'], name='observation_assigne_83ab1c_idx'),
        ),
    ]
