"""Map MatchResult confidence to dgred lead status."""

from __future__ import annotations

from agent_samochodowy.config import Settings
from agent_samochodowy.models import MatchResult

# Status names matching dgred configuration
STATUS_MATCHED = "Dopasowano"
STATUS_REVIEW = "Do weryfikacji"
STATUS_NO_MATCH = "Brak dopasowania"


def map_status(result: MatchResult, settings: Settings) -> str:
    """Map match confidence to a dgred status name."""
    if result.confidence >= settings.confidence_high:
        return STATUS_MATCHED
    if result.confidence >= settings.confidence_low:
        return STATUS_REVIEW
    return STATUS_NO_MATCH
