# 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 = [
        ('feedback', '0002_initial'),
        ('organizations', '0004_legacylocation_legacymainsection_and_more'),
        ('px_sources', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='feedback',
            name='source',
            field=models.ForeignKey(blank=True, help_text='Source of feedback', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='feedbacks', to='px_sources.pxsource'),
        ),
        migrations.AddField(
            model_name='feedback',
            name='staff',
            field=models.ForeignKey(blank=True, help_text='Staff member being mentioned in feedback', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='feedbacks', to='organizations.staff'),
        ),
        migrations.AddField(
            model_name='feedback',
            name='subsection',
            field=models.ForeignKey(blank=True, help_text='Specific subsection', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='feedbacks', to='organizations.legacysubsection'),
        ),
        migrations.AddField(
            model_name='feedbackattachment',
            name='feedback',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='feedback.feedback'),
        ),
        migrations.AddField(
            model_name='feedbackattachment',
            name='uploaded_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='feedback_attachments', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='feedbackresponse',
            name='created_by',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='feedback_responses', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='feedbackresponse',
            name='feedback',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='responses', to='feedback.feedback'),
        ),
        migrations.AddField(
            model_name='patientcomment',
            name='comment_import',
            field=models.ForeignKey(blank=True, help_text='Import batch this comment came from', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='feedback.commentimport'),
        ),
        migrations.AddField(
            model_name='patientcomment',
            name='hospital',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='patient_comments', to='organizations.hospital'),
        ),
        migrations.AddField(
            model_name='commentactionplan',
            name='comment',
            field=models.ForeignKey(blank=True, help_text='Source comment (may be null if aggregated from multiple)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='action_plans', to='feedback.patientcomment'),
        ),
        migrations.AlterUniqueTogether(
            name='commentimport',
            unique_together={('hospital', 'year', 'month')},
        ),
        migrations.AddIndex(
            model_name='feedback',
            index=models.Index(fields=['status', '-created_at'], name='feedback_fe_status_212662_idx'),
        ),
        migrations.AddIndex(
            model_name='feedback',
            index=models.Index(fields=['hospital', 'status', '-created_at'], name='feedback_fe_hospita_4c1146_idx'),
        ),
        migrations.AddIndex(
            model_name='feedback',
            index=models.Index(fields=['department', 'status', '-created_at'], name='feedback_fe_departm_be6aa4_idx'),
        ),
        migrations.AddIndex(
            model_name='feedback',
            index=models.Index(fields=['assigned_to', 'status', '-created_at'], name='feedback_fe_assigne_c79fd3_idx'),
        ),
        migrations.AddIndex(
            model_name='feedback',
            index=models.Index(fields=['feedback_type', '-created_at'], name='feedback_fe_feedbac_6b63a4_idx'),
        ),
        migrations.AddIndex(
            model_name='feedback',
            index=models.Index(fields=['is_deleted', '-created_at'], name='feedback_fe_is_dele_f543d5_idx'),
        ),
        migrations.AddIndex(
            model_name='feedbackresponse',
            index=models.Index(fields=['feedback', '-created_at'], name='feedback_fe_feedbac_bc9e33_idx'),
        ),
        migrations.AddIndex(
            model_name='patientcomment',
            index=models.Index(fields=['hospital', 'classification', 'sub_category'], name='feedback_pa_hospita_008b6d_idx'),
        ),
        migrations.AddIndex(
            model_name='patientcomment',
            index=models.Index(fields=['hospital', 'year', 'month'], name='feedback_pa_hospita_2b8ae8_idx'),
        ),
        migrations.AddIndex(
            model_name='patientcomment',
            index=models.Index(fields=['hospital', 'source_category'], name='feedback_pa_hospita_af40c7_idx'),
        ),
        migrations.AddIndex(
            model_name='commentactionplan',
            index=models.Index(fields=['hospital', 'status'], name='feedback_co_hospita_8139f7_idx'),
        ),
        migrations.AddIndex(
            model_name='commentactionplan',
            index=models.Index(fields=['hospital', 'year', 'month'], name='feedback_co_hospita_8565e5_idx'),
        ),
    ]
