"""Deferred virtual resource type definitions for the Resource Registry.

Contains the built-in deferred virtual type entries (remote, submodule,
symlink) that are appended to ``BUILTIN_TYPES`` in
``_resource_registry_data``.  Extracted to keep each module under the
500-line CONTRIBUTING limit and for consistency with
``_resource_registry_virtual`` (#329).

.. note::

    This is an **internal** module (``_``-prefixed).  External code
    should import ``BUILTIN_TYPES`` from ``_resource_registry_data``
    instead.
"""

from __future__ import annotations

from typing import Any

__all__ = ["VIRTUAL_DEFERRED_TYPES"]

# === Deferred Virtual Resource Types (#331) ===
#
# These types represent abstract identities for concepts that have
# physical counterparts introduced by #662 (deferred physical types).
# Each defines equivalence criteria used by the equivalence tracking
# service (#334) to auto-link physical resources.

VIRTUAL_DEFERRED_TYPES: list[dict[str, Any]] = [
    {
        "name": "remote",
        "description": (
            "Cross-repo remote identity. Links git-remote resources "
            "across different repos that point to the same URL."
        ),
        "resource_kind": "virtual",
        "sandbox_strategy": "none",
        "user_addable": False,
        "built_in": True,
        "cli_args": [],
        "parent_types": [],
        "child_types": ["git-remote"],
        "handler": None,
        "capabilities": {
            "read": False,
            "write": False,
            "sandbox": False,
            "checkpoint": False,
        },
        "equivalence": {
            "criteria": ["url"],
            "description": (
                "Two git-remote resources share a remote parent "
                "when they point to the same normalized URL."
            ),
        },
    },
    {
        "name": "submodule",
        "description": (
            "Cross-repo submodule identity. Links git-submodule resources "
            "across different repos with the same submodule URL and path."
        ),
        "resource_kind": "virtual",
        "sandbox_strategy": "none",
        "user_addable": False,
        "built_in": True,
        "cli_args": [],
        "parent_types": [],
        "child_types": ["git-submodule"],
        "handler": None,
        "capabilities": {
            "read": False,
            "write": False,
            "sandbox": False,
            "checkpoint": False,
        },
        "equivalence": {
            "criteria": ["url", "path"],
            "description": (
                "Two git-submodule resources share a submodule parent "
                "when they have the same submodule URL and path."
            ),
        },
    },
    {
        "name": "symlink",
        "description": (
            "Cross-layer symlink identity. Links fs-symlink and "
            "git-tree-entry (mode 120000) resources with the same "
            "name and target."
        ),
        "resource_kind": "virtual",
        "sandbox_strategy": "none",
        "user_addable": False,
        "built_in": True,
        "cli_args": [],
        "parent_types": [],
        "child_types": ["fs-symlink", "git-tree-entry"],
        "handler": None,
        "capabilities": {
            "read": False,
            "write": False,
            "sandbox": False,
            "checkpoint": False,
        },
        "equivalence": {
            "criteria": ["name", "target_path"],
            "description": (
                "Two physical symlink resources share a symlink parent "
                "when they have the same name and target path."
            ),
        },
    },
]
