"""Tests for corpo.faq_hints module."""

from corpo.faq_hints import FAQHint, format_hint, format_hints_for_field, lookup_hints


def test_lookup_by_name():
    hints = lookup_hints("name")
    assert len(hints) >= 1
    assert hints[0].category == "entity_naming"


def test_lookup_by_tax():
    hints = lookup_hints("tax")
    assert len(hints) >= 1
    assert hints[0].category == "taxation"


def test_lookup_by_vote():
    hints = lookup_hints("vote")
    assert len(hints) >= 1
    assert hints[0].category == "voting_governance"


def test_lookup_no_match():
    hints = lookup_hints("xyznonexistent")
    assert hints == []


def test_max_results():
    hints = lookup_hints("name", max_results=1)
    assert len(hints) <= 1


def test_format_hint():
    h = FAQHint(
        question="Why LAO?",
        short_answer="It signals legal compliance.",
        statutory_reference="W.S. 17-31-104(d)",
        category="entity_naming",
    )
    out = format_hint(h)
    assert "Why LAO?" in out
    assert "W.S. 17-31-104(d)" in out


def test_format_hints_for_field_match():
    result = format_hints_for_field("name")
    assert result is not None
    assert "LAO" in result


def test_format_hints_for_field_no_match():
    result = format_hints_for_field("xyznonexistent")
    assert result is None
