package com.ruoyi.common.enums;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;

import java.util.Arrays;
import java.util.Map;

@AllArgsConstructor
public enum ExamType {
    OHS(1, "单招（应届普高）", "Ordinary High School"),
    SVS(2, "单招（中职）", "Secondary Vocational School"),
    VHS(3, "职高对口升学", "Vocational High School");

    public Integer code() {
        return code;
    }

    public String title() {
        return title;
    }

    public String nameEn() {
        return nameEn;
    }

    private final Integer code;
    private final String title;
    private final String nameEn;

    public static ExamType parse(String name) {
        return valMap.get(name);
    }

    private static Map<String, ExamType> valMap = Maps.newHashMap();
    static {
        Arrays.stream(ExamType.values()).forEach(t -> {
            valMap.put(t.name(), t);
            valMap.put(t.nameEn, t);
            valMap.put(String.valueOf(t.code), t);
            valMap.put(t.title, t);
        });
    }
}
