# Generated by Django 5.2.7 on 2025-10-22 18:44

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


class Migration(migrations.Migration):

    dependencies = [
        ("nodes", "0021_remove_netmessage_confirmed_peers"),
    ]

    operations = [
        migrations.AddField(
            model_name="node",
            name="message_queue_length",
            field=models.PositiveSmallIntegerField(
                default=10,
                help_text="Maximum queued NetMessages to retain for this peer.",
            ),
        ),
        migrations.CreateModel(
            name="PendingNetMessage",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("seen", models.JSONField(default=list)),
                ("queued_at", models.DateTimeField(auto_now_add=True)),
                ("stale_at", models.DateTimeField()),
                (
                    "message",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="pending_deliveries",
                        to="nodes.netmessage",
                    ),
                ),
                (
                    "node",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="pending_net_messages",
                        to="nodes.node",
                    ),
                ),
            ],
            options={
                "ordering": ("queued_at",),
                "unique_together": {("node", "message")},
            },
        ),
    ]
