package com.qmth.teachcloud.common.enums.log;

import java.util.Objects;

/**
 * @Description: 日志等级枚举类
 * @Author: CaoZixuan
 * @Date: 2022-02-14
 */
public enum LevelEnum {
    PRIMARY("一级日志：敏感信息"),
    SECONDARY("二级日志：重要信息"),
    TERTIARY("三级日志：次要信息"),
    QUATERNARY("四级日志：普通信息"),
    ;
    private final String desc;

    LevelEnum(String desc) {
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 状态转换 toName
     *
     * @param p desc
     * @return name
     */
    public static String convertToName(String p) {
        for (LevelEnum e : LevelEnum.values()) {
            if (Objects.equals(p, e.getDesc())) {
                return e.name();
            }
        }
        return null;
    }
}
