package com.ruoyi.syzy.utils;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;

import com.alibaba.fastjson2.JSONObject;

public class BatchUtil {
    private static Map<Integer, String> typeNames = new LinkedHashMap<>(5);
    static {
        typeNames.put(0, "");
        typeNames.put(1, "普通类院校本科第一批");
        typeNames.put(2, "普通类院校本科第二批");
        typeNames.put(3, "普通类院校本科第三批");
        typeNames.put(4, "普通类院校高职专科");
    }

    public static List<JSONObject> list() {
        List<JSONObject> list = new ArrayList<>(4);
        typeNames.entrySet().forEach(row -> {
            if (StringUtils.isBlank(row.getValue())) {
                return;
            }
            JSONObject obj = new JSONObject();
            obj.put("label", row.getValue());
            obj.put("value", row.getKey());
            list.add(obj);
        });
        return list;
    }

    public static String getBatchById(Integer batch){
        String level="本科";
        if(null==batch){
            return level;
        }
        if(batch==4){
            level="专科";
        }else if(batch==0){
            level="提前批";
        }
        //batch<4时为本科，batch=0时为提前批
        return level;
    }

    public static String getLabel(Integer type) {
        return MapUtils.getString(typeNames, type, "");
    }

}
