package org.security.common.eum;

/**
 * @author Create by wzf
 * @date 2022/3/25 10:37
 * 考核时段枚举
 */
public enum evaluationTimeIntervalEnum {


	/**
	 * 考核年度枚举
	 */
	ONE("13","上半年"),
	TWO("14","下半年"),
	THREE("15","第一季度"),
	FOUR("16","第二季度"),
	FIVE("17","第三季度"),
	SIX("18","第四季度"),
	SEVEN("01","1月"),
	EIGHT("02","2月"),
	NIGHT("03","3月"),
	TEN("04","4月"),
	ELEVEN("05","5月"),
	TWELVE("06","6月"),
	THIRTEEN("07","7月"),
	FOURTEEN("08","8月"),
	FIFTEEN("09","8月"),
	SIXTEEN("10","10月"),
	SEVENTEEN("11","11月"),
	EIGHTEEN("12","12月"),
	NINETEEN("19","年度考核"),
	UNKNOWN("-1","年度考核");

	private String  code;

	private String label;

	evaluationTimeIntervalEnum(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 evaluationTimeIntervalEnum parseByCode(String code) {
		evaluationTimeIntervalEnum[] items = evaluationTimeIntervalEnum.values();
		for (evaluationTimeIntervalEnum item : items) {
			if (item.code.equals(code)) {
				return item;
			}
		}
		return UNKNOWN;
	}

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