package org.security.common.eum;

/**
 * @author ：wzf
 * @apiNote ：上传影像平台文件类型
 * @since ：Created in 2022/9/7 17:18
 */
public enum FileTypeEum {

	ONE ("1","证件"),
	TWO ("2","合同"),
	THREE ("3","发票"),
	FOUR ("4","其他"),
	FIF ("5","贷后检查材料"),
	SIX ("6","回单"),
	SEVEN ("7","财务报表"),
	EIGHT ("8","授权书"),
	NINE ("9","承诺书"),
	TEN ("10","协议"),
	ELEVEN ("11","网贷影像材料"),
	TWELVE ("12","马消贷影像材料"),
	THIRTEEN ("13","长安车贷影像材料"),
	FOURTEEN ("14","云按揭材料"),
	FIFTEEN ("15","保险材料"),
	SIXTEEN ("16","ETC材料"),
	EVENTEEN ("17","烟叶资金结算签约影像资料"),
	EIGHTEEN ("18","安全信息化管理系统影像资料"),
	UNKNOWN("-1","UNKNOWN");

	private String  code;

	private String label;

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

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