# Generated by Django 5.2.8 on 2025-12-06 15:03

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("core", "0001_initial"),
        ("emails", "0002_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name="admincommandresult",
            name="user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="command_results",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="emailartifact",
            name="collector",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="artifacts",
                to="emails.emailcollector",
            ),
        ),
        migrations.AddField(
            model_name="emailtransaction",
            name="collector",
            field=models.ForeignKey(
                blank=True,
                help_text="Collector that discovered this message, if applicable.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="transactions",
                to="emails.emailcollector",
            ),
        ),
        migrations.AddField(
            model_name="emailtransaction",
            name="inbox",
            field=models.ForeignKey(
                blank=True,
                help_text="Inbox account the message was read from or will use for sending.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="transactions",
                to="emails.emailinbox",
            ),
        ),
        migrations.AddField(
            model_name="emailtransaction",
            name="outbox",
            field=models.ForeignKey(
                blank=True,
                help_text="Outbox configuration used to send the message, when known.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="transactions",
                to="emails.emailoutbox",
            ),
        ),
        migrations.AddField(
            model_name="emailtransactionattachment",
            name="transaction",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="attachments",
                to="core.emailtransaction",
            ),
        ),
        migrations.AddField(
            model_name="invitelead",
            name="assign_to",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="%(app_label)s_%(class)s_assignments",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="invitelead",
            name="sent_via_outbox",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="invite_leads",
                to="emails.emailoutbox",
            ),
        ),
        migrations.AddField(
            model_name="invitelead",
            name="user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterUniqueTogether(
            name="emailartifact",
            unique_together={("collector", "fingerprint")},
        ),
        migrations.AddIndex(
            model_name="emailtransaction",
            index=models.Index(fields=["message_id"], name="email_txn_msgid"),
        ),
        migrations.AddIndex(
            model_name="emailtransaction",
            index=models.Index(
                fields=["direction", "status"], name="email_txn_dir_status"
            ),
        ),
    ]
