package cn.iocoder.yudao.module.bpm.enums.oa;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 工单优先级枚举
 *
 * @author 系统
 */
@Getter
@AllArgsConstructor
public enum WorkOrderLevelEnum {

    LOW(1, "低"),
    MEDIUM(2, "中"),
    HIGH(3, "高"),
    URGENT(4, "紧急");

    /**
     * 级别值
     */
    private final Integer level;

    /**
     * 级别名称
     */
    private final String name;

    /**
     * 根据级别值获取枚举
     */
    public static WorkOrderLevelEnum getByLevel(Integer level) {
        for (WorkOrderLevelEnum levelEnum : values()) {
            if (levelEnum.getLevel().equals(level)) {
                return levelEnum;
            }
        }
        return null;
    }

    /**
     * 判断是否为紧急级别
     */
    public static boolean isUrgent(Integer level) {
        return URGENT.getLevel().equals(level);
    }

    /**
     * 判断是否为高优先级（高或紧急）
     */
    public static boolean isHighPriority(Integer level) {
        return HIGH.getLevel().equals(level) || URGENT.getLevel().equals(level);
    }

} 