export function displayUnit(unit: string | null | undefined) {
    if (!unit) return "";

    const normalized = unit.trim();

    const lower = normalized.toLowerCase();

    switch (lower) {
        case "c":
        case "ºc":
        case "°c":
            return "°C";

        case "km/h":
        case "kmh":
        case "kph":
            return "km/h";

        case "w/m2":
        case "w/m²":
        case "wm2":
            return "W/m²";

        case "º":
        case "°":
        case "deg":
        case "degree":
        case "degrees":
            return "°";

        case "%":
        case "percent":
        case "percentage":
            return "%";

        case "ppm":
            return "ppm";

        case "bar":
            return "bar";

        case "mbar":
        case "mb":
        case "hpa":
            return "hPa";

        case "mm":
            return "mm";

        case "l":
        case "lt":
        case "liter":
        case "litre":
        case "litros":
            return "L";

        case "l/h":
        case "lt/h":
            return "L/h";

        case "m3":
        case "m³":
            return "m³";

        case "m3/h":
        case "m³/h":
            return "m³/h";

        case "v":
            return "V";

        case "a":
            return "A";

        case "kw":
            return "kW";

        case "kwh":
            return "kWh";

        default:
            return normalized;
    }
}