package org.security.common.eum;

/**
 * @author ：wzf
 * @apiNote ：项目节点枚举
 * @since ：Created in 2022/12/2 17:40
 */
public enum ProjectNodeEnum {

	/**
	 * 项目节点 0-开始，1-立项，2-采购，3-合同，4-实施，5-验收,6-结项,7-审阅通过
	 */
	ZERO(0,"项目开始"),
	ONE(1,"项目立项"),
	TWO(2,"项目采购"),
	THREE(3,"项目合同"),
	FOUR(4,"项目实施"),
	FIVE(5,"项目验收"),
	SIX(6,"项目结项"),
	SEVEN(7,"项目审阅通过"),
	UNKNOWN(-1,"UNKNOWN");

	private int code;

	private String label;

	ProjectNodeEnum(int code, String label) {
		this.code = code;
		this.label = label;
	}

	public int getCode() {
		return code;
	}

	public String getLabel() {
		return label;
	}

	/**
	 *
	 * @param code
	 * @return
	 */
	public static ProjectNodeEnum parseByCode(int code) {
		ProjectNodeEnum[] items = ProjectNodeEnum.values();
		for (ProjectNodeEnum item : items) {
			if (item.code == code) {
				return item;
			}
		}
		return UNKNOWN;
	}

	/**
	 *
	 * @param label
	 * @return
	 */
	public static ProjectNodeEnum parseByLabel(String label) {
		ProjectNodeEnum[] items = ProjectNodeEnum.values();
		for (ProjectNodeEnum item : items) {
			if (item.label.equalsIgnoreCase(label)) {
				return item;
			}
		}
		return UNKNOWN;
	}
}
