from pathlib import Path


def test_evidence_exposes_payment_without_document_guard_fields():
    text = Path('app/domain/opportunity_flow/evidence.py').read_text(encoding='utf-8')
    assert 'has_invalid_payment_task_without_document: bool = False' in text
    assert 'invalid_payment_task_id: str | None = None' in text
    assert 'invalid_payment_task_action_code: str | None = None' in text
    assert 'has_invalid_payment_task_without_document=bool(invalid_payment_task)' in text


def test_evidence_builds_invoice_sent_from_payload_not_only_status():
    text = Path('app/domain/opportunity_flow/evidence.py').read_text(encoding='utf-8')
    assert 'def _document_sent_evidence' in text
    assert 'clientflow_invoice_sent_evidence' in text
    assert 'invoice_sent_at' in text
    assert 'invoice_sent=None if not invoice else _document_sent_evidence(invoice)' in text
