# Generated by Django 5.2.4 on 2026-01-15 15:51

import django.utils.timezone
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("appointments", "0006_alter_appointment_booking_type"),
    ]

    operations = [
        migrations.CreateModel(
            name="WebhookEvent",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "source",
                    models.CharField(
                        choices=[("retell", "Retell AI"), ("twilio", "Twilio")],
                        max_length=50,
                    ),
                ),
                ("event_type", models.CharField(db_index=True, max_length=100)),
                ("headers", models.JSONField(blank=True, null=True)),
                ("raw_payload", models.JSONField()),
                ("processed", models.BooleanField(default=False)),
                ("processed_at", models.DateTimeField(blank=True, null=True)),
                ("success", models.BooleanField(null=True)),
                ("error_message", models.TextField(blank=True, null=True)),
                (
                    "received_at",
                    models.DateTimeField(
                        db_index=True, default=django.utils.timezone.now
                    ),
                ),
            ],
            options={
                "ordering": ["-received_at"],
                "indexes": [
                    models.Index(
                        fields=["source", "event_type"],
                        name="appointment_source_3aacd1_idx",
                    ),
                    models.Index(
                        fields=["processed"], name="appointment_process_adc318_idx"
                    ),
                ],
            },
        ),
    ]
