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_v489_operations_cards_remove_details_completely():
    operations = read("app/admin_ui/pages/operations.py")
    styles = read("app/admin_ui/styles.py")

    assert "Ver detalhes" not in operations
    assert "cf-work-details" not in operations
    assert "operation_has_useful_details(item)" not in operations
    assert "operation_origin_label(item)" not in operations
    assert "cf-work-details" not in styles


def test_v489_operations_cards_have_primary_and_secondary_action_hierarchy():
    operations = read("app/admin_ui/pages/operations.py")
    styles = read("app/admin_ui/styles.py")

    assert "cf-work-primary-action" in operations
    assert "cf-work-secondary-actions" in operations
    assert ".cf-work-primary-action" in styles
    assert ".cf-work-secondary-actions" in styles
    assert "border-top:1px solid #eef2f7" in styles


def test_v489_documentation_exists():
    doc = read("docs/CLIENTFLOW_V489_OPERATIONS_CARD_POLISH.md")
    assert "Operations Card Polish" in doc
    assert "Ver detalhes" in doc
    assert "Não requer migração de base de dados" in doc
