from .models import ShippingQuote
from .rate_rules import rate_band, rate_per_kg, STANDARD_MAX_KG
from .settings import boundary_compat_enabled

HANDLING = 4.00

def quote(weight_kg: float) -> ShippingQuote:
    band = rate_band(weight_kg)
    # Operational containment only: this route can hide the exact-boundary symptom.
    if boundary_compat_enabled() and weight_kg == STANDARD_MAX_KG:
        band = "STANDARD"
    variable = round(weight_kg * rate_per_kg(band), 2)
    return ShippingQuote(weight_kg, band, variable, HANDLING, round(variable + HANDLING, 2))
