"""Helpers for loading the repository testing contract."""

from __future__ import annotations

import json
from pathlib import Path
from typing import Any


CONTRACT_PATH = Path(__file__).with_name("quality_contract.json")


def load_contract(contract_path: Path | None = None) -> dict[str, Any]:
    """Return the parsed testing contract."""
    path = contract_path or CONTRACT_PATH
    with path.open("r", encoding="utf-8") as handle:
        return json.load(handle)
