

export const enum WeatherCode{
    //https://open-meteo.com/en/docs
    // Code	Description
    // 0	Clear sky
    // 1, 2, 3	Mainly clear, partly cloudy, and overcast
    // 45, 48	Fog and depositing rime fog
    // 51, 53, 55	Drizzle: Light, moderate, and dense intensity
    // 56, 57	Freezing Drizzle: Light and dense intensity
    // 61, 63, 65	Rain: Slight, moderate and heavy intensity
    // 66, 67	Freezing Rain: Light and heavy intensity
    // 71, 73, 75	Snow fall: Slight, moderate, and heavy intensity
    // 77	Snow grains
    // 80, 81, 82	Rain showers: Slight, moderate, and violent
    // 85, 86	Snow showers slight and heavy
    // 95 *	Thunderstorm: Slight or moderate
    // 96, 99 *	Thunderstorm with slight and heavy hail

    CLEAR_SKY = 0,
    MAINLY_CLEAR = 1,
    PARTLY_CLOUDY = 2,
    OVERCAST = 3,

    FOG = 45,
    RIME_FOG = 48,

    LIGHT_DIZZLE = 51,
    MODERATE_DIZZLE = 53,
    DENSE_DIZZLE = 55,
    LIGHT_FREEZING_DRIZZLE = 56,
    DENSE_FREEZING_DRIZZLE = 57,

    SLIGHT_RAIN = 61,
    MODERATE_RAIN = 63,
    HEAVY_RAIN = 65,
    LIGHT_FREEZING_RAIN = 66,
    HEAVY_FREEZING_RAIN = 67,

    SLIGHT_SNOWFALL = 71,
    MODERATE_SNOWFALL = 73,
    HEAVY_SNOWFALL = 75,

    SNOW_GRAINS = 77,

    SLIGHT_RAIN_SHOWER = 80,
    MODERATE_RAIN_SHOWER = 81,
    VIOLENT_RAIN_SHOWER = 82,
    SLIGHT_SNOW_SHOWER = 85,
    HEAVY_SNOW_SHOWER = 86,

    THUNDERSTORM = 95,
    SLIGHT_THUNDERSTORM = 96,
    HEAVY_THUNDERSTORM = 99
}

type WeatherCodeMapping = {
    [key in WeatherCode]: string;
}

const scheduleStatusMapping: WeatherCodeMapping = {
    0: "Cerah",
    1: "Cerah",
    2: "Berawan",
    3: "Berawan",

    45: "Berembun",
    48: "Berembun",

    51: "Hujan Rintik",
    53: "Hujan Rintik Ringan",
    55: "Hujan Rintik Sedang",
    56: "Hujan Es Rintik Ringan",
    57: "Hujan Es Rintik Sedang",

    61: "Hujan",
    63: "Hujan Sedang",
    65: "Hujan Berat",
    66: "Hujan Es Ringan",
    67: "Hujan Es Berat",

    71: "Bersalju",
    73: "Bersalju Sedang",
    75: "Bersalju Berat",

    77: "Bersalju Rintik",

    80: "Hujan Berat",
    81: "Hujan Berat Sedang",
    82: "Hujan Berat Besar",
    85: "Hujan Salju Ringan",
    86: "Hujan Salju Sedang",

    95: "Hujan Angin",
    96: "Hujan Angin Sedang",
    99: "Hujan Angin Berat"
}

export const reversePassengerNoun = (val: WeatherCode) => {
    return scheduleStatusMapping[val] || "-"
}