from __future__ import annotations

from .decision import OpportunityDecision
from .evidence import OpportunityEvidence
from .profiles import CompanyWorkflowProfile, load_company_profile
from .rules import decide_blif_next_action


def decide_opportunity_next_action(evidence: OpportunityEvidence, profile: CompanyWorkflowProfile | None = None) -> OpportunityDecision:
    """Run the company workflow profile against normalized evidence."""

    profile = profile or load_company_profile(evidence.company_profile or "blif")
    # v1 foundation ships with BLIF and default profiles. New companies can add
    # profiles without changing UI; custom rule modules can be introduced later.
    return decide_blif_next_action(evidence, profile)
