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

import datetime
import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="AdminCommandResult",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("command", models.TextField()),
                ("resolved_command", models.TextField()),
                ("command_name", models.CharField(blank=True, max_length=150)),
                ("stdout", models.TextField(blank=True)),
                ("stderr", models.TextField(blank=True)),
                ("traceback", models.TextField(blank=True)),
                ("runtime", models.DurationField(default=datetime.timedelta)),
                ("exit_code", models.IntegerField(default=0)),
                ("success", models.BooleanField(default=False)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "verbose_name": "Command Result",
                "verbose_name_plural": "Command Results",
                "ordering": ("-created_at",),
            },
        ),
        migrations.CreateModel(
            name="EmailArtifact",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("subject", models.CharField(max_length=255)),
                ("sender", models.CharField(max_length=255)),
                ("body", models.TextField(blank=True)),
                ("sigils", models.JSONField(default=dict)),
                ("fingerprint", models.CharField(max_length=32)),
            ],
            options={
                "verbose_name": "Email Artifact",
                "verbose_name_plural": "Email Artifacts",
                "ordering": ["-id"],
            },
        ),
        migrations.CreateModel(
            name="EmailTransaction",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "direction",
                    models.CharField(
                        choices=[("inbound", "Inbound"), ("outbound", "Outbound")],
                        default="inbound",
                        help_text="Whether the message originated from an inbox or is being sent out.",
                        max_length=8,
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("collected", "Collected"),
                            ("queued", "Queued"),
                            ("sent", "Sent"),
                            ("failed", "Failed"),
                        ],
                        default="collected",
                        help_text="Lifecycle stage for the stored email message.",
                        max_length=9,
                    ),
                ),
                (
                    "message_id",
                    models.CharField(
                        blank=True,
                        help_text="Message-ID header for threading and deduplication.",
                        max_length=255,
                    ),
                ),
                (
                    "thread_id",
                    models.CharField(
                        blank=True,
                        help_text="Thread or conversation identifier, if provided by the provider.",
                        max_length=255,
                    ),
                ),
                ("subject", models.CharField(blank=True, max_length=998)),
                (
                    "from_address",
                    models.CharField(
                        blank=True,
                        help_text="From header as provided by the email message.",
                        max_length=512,
                    ),
                ),
                (
                    "sender_address",
                    models.CharField(
                        blank=True,
                        help_text="Envelope sender address, if available.",
                        max_length=512,
                    ),
                ),
                (
                    "to_addresses",
                    models.JSONField(
                        blank=True,
                        default=list,
                        help_text="List of To recipient addresses.",
                    ),
                ),
                (
                    "cc_addresses",
                    models.JSONField(
                        blank=True,
                        default=list,
                        help_text="List of Cc recipient addresses.",
                    ),
                ),
                (
                    "bcc_addresses",
                    models.JSONField(
                        blank=True,
                        default=list,
                        help_text="List of Bcc recipient addresses.",
                    ),
                ),
                (
                    "reply_to_addresses",
                    models.JSONField(
                        blank=True,
                        default=list,
                        help_text="List of Reply-To addresses from the message headers.",
                    ),
                ),
                (
                    "headers",
                    models.JSONField(
                        blank=True,
                        default=dict,
                        help_text="Complete header map as parsed from the message.",
                    ),
                ),
                (
                    "metadata",
                    models.JSONField(
                        blank=True,
                        default=dict,
                        help_text="Additional provider-specific metadata.",
                    ),
                ),
                ("body_text", models.TextField(blank=True)),
                ("body_html", models.TextField(blank=True)),
                (
                    "raw_content",
                    models.TextField(
                        blank=True,
                        help_text="Raw RFC822 payload for the message, if stored.",
                    ),
                ),
                (
                    "message_ts",
                    models.DateTimeField(
                        blank=True,
                        help_text="Timestamp supplied by the email headers.",
                        null=True,
                    ),
                ),
                (
                    "queued_at",
                    models.DateTimeField(
                        blank=True,
                        help_text="When the message was queued for outbound delivery.",
                        null=True,
                    ),
                ),
                (
                    "processed_at",
                    models.DateTimeField(
                        blank=True,
                        help_text="When the message was sent or fully processed.",
                        null=True,
                    ),
                ),
                (
                    "error",
                    models.TextField(
                        blank=True,
                        help_text="Failure details captured during processing, if any.",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "verbose_name": "Email Transaction",
                "verbose_name_plural": "Email Transactions",
                "ordering": ["-created_at", "-id"],
            },
        ),
        migrations.CreateModel(
            name="EmailTransactionAttachment",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("filename", models.CharField(blank=True, max_length=255)),
                ("content_type", models.CharField(blank=True, max_length=255)),
                (
                    "content_id",
                    models.CharField(
                        blank=True,
                        help_text="Identifier used for inline attachments.",
                        max_length=255,
                    ),
                ),
                (
                    "inline",
                    models.BooleanField(
                        default=False,
                        help_text="Marks whether the attachment is referenced inline in the body.",
                    ),
                ),
                (
                    "size",
                    models.PositiveIntegerField(
                        blank=True,
                        help_text="Size of the decoded attachment payload in bytes.",
                        null=True,
                    ),
                ),
                (
                    "content",
                    models.TextField(
                        blank=True, help_text="Base64 encoded attachment payload."
                    ),
                ),
            ],
            options={
                "verbose_name": "Email Attachment",
                "verbose_name_plural": "Email Attachments",
            },
        ),
        migrations.CreateModel(
            name="InviteLead",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("path", models.TextField(blank=True)),
                ("referer", models.TextField(blank=True)),
                ("user_agent", models.TextField(blank=True)),
                (
                    "ip_address",
                    models.CharField(
                        blank=True,
                        max_length=45,
                        validators=[django.core.validators.validate_ipv46_address],
                    ),
                ),
                ("created_on", models.DateTimeField(auto_now_add=True)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("open", "Open"),
                            ("assigned", "Assigned"),
                            ("closed", "Closed"),
                        ],
                        default="open",
                        max_length=20,
                    ),
                ),
                ("email", models.EmailField(max_length=254)),
                ("comment", models.TextField(blank=True)),
                ("sent_on", models.DateTimeField(blank=True, null=True)),
                ("error", models.TextField(blank=True)),
                ("mac_address", models.CharField(blank=True, max_length=17)),
            ],
            options={
                "verbose_name": "Invite Lead",
                "verbose_name_plural": "Invite Leads",
            },
        ),
    ]
