package org.security.common.eum;

/**
 * @author Create by wzf
 * @date 2022/6/10 16:10
 */
public enum OtherDataEnum {

	/**
	 * 是否存在问题
	 */
	ZERO("0","否"),
	ONE("1","是"),

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

	private String  code;

	private String label;

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

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