# Generated by Django 5.2.9 on 2026-01-08 23:20

from django.db import migrations


REFERENCES_TO_REMOVE = [
    {
        "value": "https://www.debian.org/releases/bookworm/",
        "alt_text": "Debian 12 (Bookworm)",
    },
    {
        "value": "https://www.microsoft.com/windows/windows-11",
        "alt_text": "Windows 11",
    },
]


def remove_os_footer_references(apps, schema_editor):
    Reference = apps.get_model("links", "Reference")
    for reference in REFERENCES_TO_REMOVE:
        Reference.objects.filter(
            value=reference["value"],
            alt_text=reference["alt_text"],
        ).delete()


def restore_os_footer_references(apps, schema_editor):
    Reference = apps.get_model("links", "Reference")
    for reference in REFERENCES_TO_REMOVE:
        Reference.objects.get_or_create(
            value=reference["value"],
            alt_text=reference["alt_text"],
            defaults={
                "method": "link",
                "include_in_footer": True,
                "footer_visibility": "public",
                "is_seed_data": True,
            },
        )


class Migration(migrations.Migration):

    dependencies = [
        ("links", "0007_update_reference_mysql_to_sqlite"),
    ]

    operations = [
        migrations.RunPython(
            remove_os_footer_references, restore_os_footer_references
        ),
    ]
