# Generated by Django 4.1.6 on 2023-02-12 16:46

import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="SentMessage",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        default=django.utils.timezone.now, editable=False
                    ),
                ),
                ("esp_name", models.CharField(editable=False, max_length=256)),
                (
                    "message_id",
                    models.CharField(editable=False, max_length=256, null=True),
                ),
                ("subject", models.CharField(editable=False, max_length=998)),
                ("content", models.TextField(editable=False, null=True)),
                ("content_html", models.TextField(editable=False, null=True)),
                ("status", models.CharField(editable=False, max_length=256)),
                ("recipient_email", models.EmailField(editable=False, max_length=254)),
                (
                    "recipient",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="MessageEvent",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_on", models.DateTimeField(editable=False)),
                ("event_name", models.CharField(editable=False, max_length=32)),
                ("payload", models.JSONField(default=dict, editable=False)),
                (
                    "sent_message",
                    models.ForeignKey(
                        editable=False,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="message_events",
                        to="anymail_history.sentmessage",
                    ),
                ),
            ],
        ),
        migrations.AddIndex(
            model_name="sentmessage",
            index=models.Index(
                fields=["created_on"], name="anymail_his_created_22d036_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="sentmessage",
            index=models.Index(
                fields=["message_id"], name="anymail_his_message_1731a8_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="sentmessage",
            index=models.Index(
                fields=["recipient_email"], name="anymail_his_recipie_b46581_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="messageevent",
            index=models.Index(
                fields=["created_on"], name="anymail_his_created_04c5bf_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="messageevent",
            index=models.Index(
                fields=["event_name"], name="anymail_his_event_n_63f45f_idx"
            ),
        ),
    ]
