package com.multictrl.common.utils.weather;

/**
 * 飞速级别转换
 *
 * @author Sdy
 * @since 1.0.0 2025/10/12
 */
public class WindSpeedConverter {

    /**
     * 根据级别名称获取最大风速
     *
     * @param levelName 级别名称 ("≤3", "4", "5", ..., "12")
     * @return 最大风速 (m/s)
     */
    public static double getMaxWindSpeed(String levelName) {
        return switch (levelName) {
            case "≤3" -> 5.4;
            case "4" -> 7.9;
            case "5" -> 10.7;
            case "6" -> 13.8;
            case "7" -> 17.1;
            case "8" -> 20.7;
            case "9" -> 24.4;
            case "10" -> 28.4;
            case "11" -> 32.6;
            case "12" -> 56.0;
            default -> throw new IllegalArgumentException("无效的级别名称: " + levelName);
        };
    }

    /**
     * 获取指定级别的最小风速
     */
    public static double getMinWindSpeed(String levelName) {
        return switch (levelName) {
            case "≤3" -> 0.0;
            case "4" -> 5.5;
            case "5" -> 8.0;
            case "6" -> 10.8;
            case "7" -> 13.9;
            case "8" -> 17.2;
            case "9" -> 20.8;
            case "10" -> 24.5;
            case "11" -> 28.5;
            case "12" -> 32.7;
            default -> throw new IllegalArgumentException("无效的级别名称: " + levelName);
        };
    }
}
