package com.ym.mec.education.enums;

import com.ym.mec.common.enums.BaseEnum;
import java.util.Arrays;

//职务类型（指导老师、教务老师、教学主管）
public enum JobTypeEnum implements BaseEnum<String, JobTypeEnum> {
    ADVISER("ADVISER", "指导老师"), ACADEMIC("ACADEMIC", "教务老师"), TEACHING("TEACHING", "教学主管"), ASSISTANT("ASSISTANT", "助教");

    private String code;

    private String msg;

    JobTypeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String getCode() {
        return this.code;
    }

    /**
     * 根据枚举值获取枚举信息
     *
     * @param code 枚举值
     * @return 枚举信息
     */
    public static String getMsgByCode(String code) {
        return Arrays.stream(JobTypeEnum.values())
            .filter(JobTypeEnum -> JobTypeEnum.getCode().equals(code))
            .findFirst()
            .map(JobTypeEnum::getMsg).orElse(null);
    }
}
