package com.ankaibei.workFlow.webadmin.ankaibei.enums;

public enum TaskStatus {
    //1 已分配 2 未分配 3 已延期
    ALLOCATION_ED("1", "已分配"),
    NO_ALLOCATION("2", "未分配"),
    EXTENSION_ED("3", "已延期"),
    FINISH_ED("4", "已完成"),
    ;

    /**
     * 状态码
     */
    private final String code;
    /**
     * 信息
     */
    private final String reason;

    /**
     * 666666
     */
    TaskStatus(String code, String reason) {
        this.code = code;
        this.reason = reason;
    }

    public String getCode() {
        return code;
    }

    public String getReason() {
        return reason;
    }

    /**
     * 通过枚举的code,查询对应的枚举项
     *
     * @param code
     * @return
     */
    public static TaskStatus getEnumByCode(String code) {
        TaskStatus[] values = TaskStatus.values();
        for (TaskStatus statusEnums : values) {
            if (statusEnums.getCode().equals(code)) {
                return statusEnums;
            }
        }
        return null;
    }
}
