from typing import Any
from typing import Dict

from ..version_utils import has_minimal_version


def adapt_legacy_metadata(metadata: Dict[str, Any]) -> None:
    """Modifies ``metadata`` in case the installed ``icat-esrf-definitions``
    library does not support the latest ICAT metadata schema.
    """
    if not has_minimal_version("icat-esrf-definitions", "2.0.0"):
        _ = metadata.pop("technique_pid")
