# Generated by Django 5.2.3 on 2025-06-24 20:27

import uuid

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


class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="OutboxEvent",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("spec_version", models.CharField(default="1.0", max_length=10)),
                ("event_type", models.CharField(db_index=True, max_length=255)),
                ("source", models.CharField(max_length=255)),
                ("subject", models.CharField(blank=True, max_length=255)),
                (
                    "data_content_type",
                    models.CharField(default="application/json", max_length=100),
                ),
                ("data_schema", models.URLField(blank=True)),
                ("data", models.JSONField(blank=True, null=True)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("pending", "Pending"),
                            ("processing", "Processing"),
                            ("published", "Published"),
                            ("failed", "Failed"),
                            ("retry", "Retry"),
                        ],
                        db_index=True,
                        default="pending",
                        max_length=20,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "scheduled_at",
                    models.DateTimeField(
                        db_index=True, default=django.utils.timezone.now
                    ),
                ),
                ("published_at", models.DateTimeField(blank=True, null=True)),
                ("retry_count", models.PositiveIntegerField(default=0)),
                ("max_retries", models.PositiveIntegerField(default=3)),
                ("last_error", models.TextField(blank=True)),
                ("publisher_backend", models.CharField(blank=True, max_length=100)),
                ("publisher_config", models.JSONField(blank=True, default=dict)),
            ],
            options={
                "db_table": "outbox_events",
                "indexes": [
                    models.Index(
                        fields=["status", "scheduled_at"],
                        name="outbox_even_status_83a3ef_idx",
                    ),
                    models.Index(
                        fields=["event_type", "created_at"],
                        name="outbox_even_event_t_fc32b0_idx",
                    ),
                ],
            },
        ),
    ]
