package shop.alien.util.common;

import shop.alien.util.common.constant.ViolationEnum;
import java.util.HashMap;
import java.util.Map;

// 枚举工具类，通过code获取value
public class EnumUtil {
    private static final Map<Integer, String> STATUS_MAP = new HashMap<>();

    static {
        for (ViolationEnum status : ViolationEnum.values()) {
            STATUS_MAP.put(status.getCode(), status.getValue());
        }
    }

    public static String getStatusValue(int code) {
        return STATUS_MAP.getOrDefault(code, "未知状态码");
    }
}
