# Generated by Django 5.1 on 2025-08-01 20:27

import django.contrib.postgres.indexes
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("email_log", "0006_email_extra_headers_email_reply_to"),
    ]

    operations = [
        migrations.CreateModel(
            name="Log",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "email",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="logs",
                        to="email_log.email",
                        verbose_name="email",
                    ),
                ),
                ("esp", models.CharField(verbose_name="ESP", max_length=255)),
                ("metadata", models.JSONField()),
                ("type", models.CharField(max_length=255)),
                ("timestamp", models.DateTimeField()),
                ("event_id", models.TextField()),
                (
                    "mta_response",
                    models.TextField(null=True, verbose_name="MTA Response"),
                ),
                ("reject_reason", models.TextField(null=True)),
                ("tags", models.JSONField()),
                ("user_agent", models.TextField(null=True)),
                (
                    "click_url",
                    models.URLField(
                        null=True, verbose_name="Click URL", max_length=4192
                    ),
                ),
                ("raw", models.JSONField()),
            ],
            options={
                "ordering": ["email", "timestamp"],
            },
        ),
        migrations.AddIndex(
            model_name="email",
            index=django.contrib.postgres.indexes.GinIndex(
                fields=["extra_headers"], name="email_log_e_extra_h_b45426_gin"
            ),
        ),
    ]
