from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]


def read(path: str) -> str:
    return (ROOT / path).read_text(encoding="utf-8")


def test_legacy_suggested_reply_card_is_hidden_in_modern_detail():
    tasks = read("app/admin_ui/pages/tasks.py")
    assert "v4928.1.5.8" in tasks or "v4928.1.5.9" in tasks or "v4928.1.5.10" in tasks or "v4928.1.5.11" in tasks or "v4928.1.5.12" in tasks or "v4928.1.5.13" in tasks
    assert "Mensagem sugerida</h2>" not in tasks
    assert "suggested-reply-text" in tasks
    assert "d-none" in tasks


def test_copy_button_prefers_editable_reply_body():
    tasks = read("app/admin_ui/pages/tasks.py")
    assert "reply-message-body" in tasks
    assert "editable.value" in tasks
    assert "copySuggestedReply" in tasks


def test_openrouter_prompt_has_readable_proposal_structure():
    llm = read("app/llm_reply_generator.py")
    assert "estrutura como proposta comercial" in llm
    assert "usar o preço de catálogo s/IVA" in llm
    assert "não inventar cabo extra" in llm.lower()
