# Generated by Django 5.0.14 on 2026-01-10 20:27 import django.db.models.deletion import uuid from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('complaints', '0004_inquiryattachment_inquiryupdate'), ('organizations', '0006_staff_email'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='ComplaintExplanation', fields=[ ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('explanation', models.TextField(help_text="Staff's explanation about the complaint")), ('token', models.CharField(db_index=True, help_text='Unique access token for explanation submission', max_length=64, unique=True)), ('is_used', models.BooleanField(db_index=True, default=False, help_text='Token expiry tracking - becomes True after submission')), ('submitted_via', models.CharField(choices=[('email_link', 'Email Link'), ('direct', 'Direct Entry')], default='email_link', help_text='How the explanation was submitted', max_length=20)), ('email_sent_at', models.DateTimeField(blank=True, help_text='When the explanation request email was sent', null=True)), ('responded_at', models.DateTimeField(blank=True, help_text='When the explanation was submitted', null=True)), ('request_message', models.TextField(blank=True, help_text='Optional message sent with the explanation request')), ('complaint', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='explanations', to='complaints.complaint')), ('requested_by', models.ForeignKey(blank=True, help_text='User who requested the explanation', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='requested_complaint_explanations', to=settings.AUTH_USER_MODEL)), ('staff', models.ForeignKey(blank=True, help_text='Staff member who submitted the explanation', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='complaint_explanations', to='organizations.staff')), ], options={ 'verbose_name': 'Complaint Explanation', 'verbose_name_plural': 'Complaint Explanations', 'ordering': ['-created_at'], }, ), migrations.CreateModel( name='ExplanationAttachment', fields=[ ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('file', models.FileField(upload_to='explanation_attachments/%Y/%m/%d/')), ('filename', models.CharField(max_length=500)), ('file_type', models.CharField(blank=True, max_length=100)), ('file_size', models.IntegerField(help_text='File size in bytes')), ('description', models.TextField(blank=True)), ('explanation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='complaints.complaintexplanation')), ], options={ 'verbose_name': 'Explanation Attachment', 'verbose_name_plural': 'Explanation Attachments', 'ordering': ['-created_at'], }, ), migrations.AddIndex( model_name='complaintexplanation', index=models.Index(fields=['complaint', '-created_at'], name='complaints__complai_b20e58_idx'), ), migrations.AddIndex( model_name='complaintexplanation', index=models.Index(fields=['token', 'is_used'], name='complaints__token_f8f9b7_idx'), ), ]