package com.xunmei.common.core.enums.edu;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.LinkedHashMap;
import java.util.Map;

@Getter
@AllArgsConstructor
public enum EduTrainingDoStatus {

    WAIT_RECORDED(0, "待记录"),
    WAIT_SIGN(1, "待签名"),
    DONE(2, "已完成"),


    ;


    /**
     * 所有枚举
     */
    private static final Map<Integer, EduTrainingDoStatus> enumMap = new LinkedHashMap<>();

    static {
        for (EduTrainingDoStatus enumNode : EduTrainingDoStatus.values()) {
            enumMap.put(enumNode.code, enumNode);
        }
    }

    private final Integer code;
    private final String name;

    /**
     * 根据code获取name
     */
    public static String getName(Integer code) {
        EduTrainingDoStatus e = enumMap.get(code);
        return e != null ? e.getName() : "";
    }

}
