# Generated by Codex on 2026-03-23.

from __future__ import annotations

from typing import Any, ClassVar

from django.core.management import call_command
from django.db import migrations

#: The fixture loaded by this migration.
FIXTURE_NAME: str = "search_notes"


def load_fixture(apps: Any, schema_editor: Any) -> None:
    """
    Load the demo ``SearchNote`` fixture after the schema is in place.

    Args:
        apps: Historical app registry provided by Django migrations.
        schema_editor: Active schema editor for this migration run.

    Side Effects:
        Loads ``search_notes.json`` into the demo database.

    """
    del apps, schema_editor
    call_command("loaddata", FIXTURE_NAME, app_label="core")


def noop_reverse(apps: Any, schema_editor: Any) -> None:
    """
    Leave demo fixture rows untouched when reversing this migration.

    Args:
        apps: Historical app registry provided by Django migrations.
        schema_editor: Active schema editor for this migration run.

    """
    del apps, schema_editor


class Migration(migrations.Migration):
    """
    Load the demo ``SearchNote`` fixture after the schema alignment migration.
    """

    #: Migrations that must run before this migration.
    dependencies: ClassVar[list[tuple[str, str]]] = [
        ("core", "0002_alter_searchnote_options_alter_searchnote_created_and_more"),
    ]

    #: Operations applied by this migration.
    operations: ClassVar[list[Any]] = [
        migrations.RunPython(load_fixture, reverse_code=noop_reverse),
    ]
