"""Terminology mapping — הלכה / כלל פרשני / עיקרון by source (#152, Phase D)."""
from __future__ import annotations

from legal_mcp.services import principles as pr


def test_binding_higher_court_is_halacha():
    assert pr.label("external_upload", True) == "הלכה"
    assert pr.principle_class("external_upload", True) == pr.CLASS_HALACHA


def test_committee_is_interpretive_rule():
    # the appeals committee applies law — never makes a הלכה
    assert pr.label("internal_committee", True) == "כלל פרשני"
    assert pr.label("internal_committee", False) == "כלל פרשני"
    assert pr.principle_class("internal_committee", False) == pr.CLASS_INTERPRETIVE_RULE


def test_non_binding_external_is_principle():
    assert pr.label("external_upload", False) == "עיקרון"
    assert pr.label(None, None) == "עיקרון"


def test_label_for_class_roundtrip():
    for sk, binding in [("external_upload", True), ("internal_committee", False), (None, False)]:
        cls = pr.principle_class(sk, binding)
        assert pr.label_for_class(cls) == pr.label(sk, binding)
