package org.security.common.eum;

/**
 * @author Create by wzf
 * @date 2022/3/25 10:11
 * 考核年度枚举
 */
public enum AssessmentYearEnum {
	/**
	 * 考核年度枚举
	 */
	ONE("1","年度"),
	TWO("2","半年"),
	THREE("3","季度"),
	FOUR("4","月份"),

	UNKNOWN("-1","unknown");

	private String  code;

	private String label;

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

	public String getCode() {
		return code;
	}

	public String getLabel() {
		return label;
	}

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

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