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

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('organizations', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='CallCenterInteraction',
            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)),
                ('caller_name', models.CharField(blank=True, max_length=200)),
                ('caller_phone', models.CharField(blank=True, max_length=20)),
                ('caller_relationship', models.CharField(choices=[('patient', 'Patient'), ('family', 'Family Member'), ('other', 'Other')], default='patient', max_length=50)),
                ('call_type', models.CharField(choices=[('inquiry', 'Inquiry'), ('complaint', 'Complaint'), ('appointment', 'Appointment'), ('follow_up', 'Follow-up'), ('feedback', 'Feedback'), ('other', 'Other')], db_index=True, max_length=50)),
                ('subject', models.CharField(max_length=500)),
                ('notes', models.TextField(blank=True)),
                ('wait_time_seconds', models.IntegerField(blank=True, help_text='Time caller waited before agent answered', null=True)),
                ('call_duration_seconds', models.IntegerField(blank=True, help_text='Total call duration', null=True)),
                ('satisfaction_rating', models.IntegerField(blank=True, help_text='Caller satisfaction rating (1-5)', null=True)),
                ('is_low_rating', models.BooleanField(db_index=True, default=False, help_text='True if rating below threshold (< 3)')),
                ('resolved', models.BooleanField(default=False)),
                ('resolution_notes', models.TextField(blank=True)),
                ('call_started_at', models.DateTimeField(auto_now_add=True)),
                ('call_ended_at', models.DateTimeField(blank=True, null=True)),
                ('metadata', models.JSONField(blank=True, default=dict)),
                ('agent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='call_center_interactions', to=settings.AUTH_USER_MODEL)),
                ('department', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='call_center_interactions', to='organizations.department')),
                ('hospital', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='call_center_interactions', to='organizations.hospital')),
                ('patient', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='call_center_interactions', to='organizations.patient')),
            ],
            options={
                'ordering': ['-call_started_at'],
                'indexes': [models.Index(fields=['hospital', '-call_started_at'], name='callcenter__hospita_108d22_idx'), models.Index(fields=['agent', '-call_started_at'], name='callcenter__agent_i_51efd4_idx'), models.Index(fields=['is_low_rating', '-call_started_at'], name='callcenter__is_low__cbe9c7_idx')],
            },
        ),
        migrations.CreateModel(
            name='CallRecord',
            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)),
                ('media_id', models.UUIDField(help_text='Unique media ID from recording system', unique=True)),
                ('media_type', models.CharField(default='Calls', help_text='Type of media (e.g., Calls)', max_length=50)),
                ('chain', models.CharField(blank=True, help_text='Chain identifier', max_length=255)),
                ('evaluated', models.BooleanField(default=False, help_text='Whether the call has been evaluated')),
                ('call_start', models.DateTimeField(help_text='Call start time')),
                ('call_end', models.DateTimeField(blank=True, help_text='Call end time', null=True)),
                ('call_length', models.CharField(blank=True, help_text='Call length as HH:MM:SS', max_length=20)),
                ('call_duration_seconds', models.IntegerField(blank=True, help_text='Call duration in seconds', null=True)),
                ('first_name', models.CharField(blank=True, help_text='Caller first name', max_length=100)),
                ('last_name', models.CharField(blank=True, help_text='Caller last name', max_length=100)),
                ('extension', models.CharField(blank=True, help_text='Extension number', max_length=20)),
                ('department', models.CharField(blank=True, help_text='Department name', max_length=255)),
                ('location', models.CharField(blank=True, help_text='Location', max_length=255)),
                ('inbound_id', models.CharField(blank=True, help_text='Inbound call ID', max_length=50)),
                ('inbound_name', models.CharField(blank=True, help_text='Inbound caller name/number', max_length=255)),
                ('dnis', models.CharField(blank=True, help_text='Dialed Number Identification Service', max_length=50)),
                ('outbound_id', models.CharField(blank=True, help_text='Outbound call ID', max_length=50)),
                ('outbound_name', models.CharField(blank=True, help_text='Outbound caller name/number', max_length=255)),
                ('flag_name', models.CharField(blank=True, help_text='Flag name', max_length=100)),
                ('flag_value', models.CharField(blank=True, help_text='Flag value', max_length=100)),
                ('file_location', models.CharField(blank=True, help_text='File system location', max_length=500)),
                ('file_name', models.CharField(blank=True, help_text='Recording file name', max_length=500)),
                ('file_hash', models.CharField(blank=True, help_text='File hash for integrity', max_length=64)),
                ('external_ref', models.CharField(blank=True, help_text='External reference number', max_length=100)),
                ('transfer_from', models.CharField(blank=True, help_text='Transfer source', max_length=255)),
                ('recorded_by', models.CharField(blank=True, help_text='Recording system/user', max_length=255)),
                ('time_zone', models.CharField(default='03:00:00', help_text='Time zone offset', max_length=50)),
                ('recording_server_name', models.CharField(blank=True, help_text='Recording server name', max_length=100)),
                ('hospital', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='call_records', to='organizations.hospital')),
            ],
            options={
                'ordering': ['-call_start'],
                'indexes': [models.Index(fields=['-call_start'], name='callcenter__call_st_75009b_idx'), models.Index(fields=['department'], name='callcenter__departm_94649e_idx'), models.Index(fields=['evaluated'], name='callcenter__evaluat_715b40_idx'), models.Index(fields=['hospital', '-call_start'], name='callcenter__hospita_40f3a7_idx')],
            },
        ),
    ]
