# Generated by GitHub Copilot on 2026-01-24

# Django
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("indy_hub", "0075_notificationwebhook_indy_hub_webhook_type_idx_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="NotificationWebhookMessage",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "webhook_type",
                    models.CharField(
                        choices=[
                            ("material_exchange", "Material Exchange"),
                            ("blueprint_sharing", "Blueprint sharing"),
                        ],
                        max_length=32,
                    ),
                ),
                ("webhook_url", models.URLField(max_length=500)),
                ("message_id", models.CharField(max_length=32)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "buy_order",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=models.deletion.CASCADE,
                        related_name="webhook_messages",
                        to="indy_hub.materialexchangebuyorder",
                    ),
                ),
                (
                    "copy_request",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=models.deletion.CASCADE,
                        related_name="webhook_messages",
                        to="indy_hub.blueprintcopyrequest",
                    ),
                ),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.AddIndex(
            model_name="notificationwebhookmessage",
            index=models.Index(fields=["webhook_type"], name="indy_webhook_msg_type"),
        ),
        migrations.AddIndex(
            model_name="notificationwebhookmessage",
            index=models.Index(fields=["message_id"], name="indy_webhook_msg_id"),
        ),
        migrations.AddIndex(
            model_name="notificationwebhookmessage",
            index=models.Index(fields=["buy_order"], name="indy_webhook_msg_buy"),
        ),
        migrations.AddIndex(
            model_name="notificationwebhookmessage",
            index=models.Index(fields=["copy_request"], name="indy_webhook_msg_copy"),
        ),
    ]
