package com.simuwang.base.pojo.valuation;

import java.util.stream.Stream;

/**
 * 资产估值表类型
 * 
 * @author William
 */
public enum AssetsValuationType {
	/** 赢时胜,id=1 */
	YSSTech(1),

	/** 恒生,id=2 */
	HangSeng(2),

	/** 金证,id=3 */
	SZKingdom(3),

	/** 百航,id=4 */
	BaiHang(4),

	/** GeneralTemplate,id=5 */
	GeneralTemplate(5);

	private int id;

	private AssetsValuationType(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	public static AssetsValuationType[] getAllType() {
		return AssetsValuationType.values();
	}
	
	public static boolean isValid(int id) {
		return Stream.of(AssetsValuationType.values()).anyMatch(t -> t.getId() == id);
	}

	public static AssetsValuationType getType(int id) {
		return Stream.of(AssetsValuationType.values()).filter(t -> t.getId() == id).findFirst().orElse(null);
	}
}
