# Generated by Django 5.2.8 on 2025-11-27 04:43

import django.core.validators
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('schedule', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='CommunicationSession',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('twilio_conversation_sid', models.CharField(db_index=True, help_text='Twilio Conversation SID', max_length=255, unique=True)),
                ('is_active', models.BooleanField(db_index=True, default=True, help_text='Whether the conversation is active')),
                ('staff_phone', models.CharField(help_text="Staff member's phone number (E.164 format)", max_length=20, validators=[django.core.validators.RegexValidator(message='Phone number must be in E.164 format (+1234567890)', regex='^\\+?1?\\d{9,15}$')])),
                ('customer_phone', models.CharField(help_text="Customer's phone number (E.164 format)", max_length=20, validators=[django.core.validators.RegexValidator(message='Phone number must be in E.164 format (+1234567890)', regex='^\\+?1?\\d{9,15}$')])),
                ('language_code', models.CharField(default='en', help_text='Language preference for SMS templates (en/es/fr/de)', max_length=10)),
                ('staff_participant_sid', models.CharField(blank=True, help_text='Twilio Participant SID for staff', max_length=255)),
                ('customer_participant_sid', models.CharField(blank=True, help_text='Twilio Participant SID for customer', max_length=255)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('closed_at', models.DateTimeField(blank=True, help_text='When the conversation was closed', null=True)),
                ('event', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='communication_session', to='schedule.event')),
            ],
            options={
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['is_active', 'created_at'], name='communicati_is_acti_ebcdc9_idx')],
            },
        ),
    ]
