package cn.teammodel.utils;

import java.util.HashMap;
import java.util.Map;

public class MonthToNumberConverter {

    private static final Map<String, Integer> monthMap = createMonthMap();

    private static Map<String, Integer> createMonthMap() {
        Map<String, Integer> map = new HashMap<>();
        map.put("JANUARY", 1);
        map.put("FEBRUARY", 2);
        map.put("MARCH", 3);
        map.put("APRIL", 4);
        map.put("MAY", 5);
        map.put("JUNE", 6);
        map.put("JULY", 7);
        map.put("AUGUST", 8);
        map.put("SEPTEMBER", 9);
        map.put("OCTOBER", 10);
        map.put("NOVEMBER", 11);
        map.put("DECEMBER", 12);
        return map;
    }

    public static int convertMonthToNumber(String monthName) {
        return monthMap.getOrDefault(monthName, -1); // 如果找不到对应月份，则返回 -1
    }

   /* public static void main(String[] args) {
        String month = "August";
        int monthNumber = convertMonthToNumber(month);
        System.out.println("The number for " + month + " is: " + monthNumber);
    }*/
}