from pathlib import Path

TASKS = Path('app/admin_ui/pages/tasks.py').read_text(encoding='utf-8')


def test_task_detail_reconciles_preparation_missing_with_fiscal_customer():
    assert '_effective_missing_items_for_task' in TASKS
    assert '_is_fiscal_preparation_missing_item' in TASKS
    assert 'customer.company' in TASKS
    assert 'billing.billing_address' in TASKS
    assert 'fiscal_customer=fiscal_customer' in TASKS


def test_task_primary_action_does_not_keep_stale_missing_data_when_ready():
    assert '_effective_primary_action_for_task' in TASKS
    assert 'pedir dados em falta' in TASKS
    assert 'primary_action_text' in TASKS
    assert "{esc(primary_action_text)}" in TASKS


def test_task_suggested_reply_avoids_stale_billing_data_request_when_ready():
    assert '_effective_suggested_reply_for_task' in TASKS
    assert '_ready_document_reply_for_task' in TASKS
    assert 'Segue em anexo a fatura pró-forma solicitada' in TASKS
    assert 'stale_markers' in TASKS
