/** El problema: todas las tarifas en un solo método, elegidas con un switch. */
public class ShippingSwitch {
    static Money cost(String kind, Parcel parcel) {
        return switch (kind) {
            case "flat" -> Money.of(1000, "PEN");
            case "weight" -> {
                long kilos = (parcel.grams() + 999) / 1000;
                yield Money.of(500 + 300 * kilos, "PEN");
            }
            case "free-above" -> parcel.subtotal().isLessThan(Money.of(15000, "PEN"))
                    ? cost("weight", parcel)
                    : Money.zero();
            default -> throw new IllegalArgumentException("tarifa desconocida: " + kind);
        };
    }
}
