"""
Static average time to invoice (days) by branch and department — past 30 days roll-up.
Replace with live data when Simpro/reporting is wired up.
"""
from typing import Dict

# Values are days from job complete (or equivalent) to invoice sent — per business data entry.
AVG_TIME_TO_INVOICE_DAYS: Dict[str, Dict[str, float]] = {
    "Bunbury": {
        "Electrics": 3.44,
        "AC": 2.67,
        "Solar": 1.64,
        "Commercial": 3.57,
    },
    "Busselton": {
        "Electrics": 4.84,
        "AC": 2.37,
    },
    "Mandurah": {
        "Electrics": 0.27,
        "AC": 0.87,
    },
}


def get_avg_time_to_invoice_for_branch(branch_name: str) -> Dict[str, float]:
    """Return department → average days for this branch. Empty dict if unknown branch."""
    raw = AVG_TIME_TO_INVOICE_DAYS.get(branch_name)
    return dict(raw) if raw else {}
