package com.cusc.nirvana.user.rnr.fp.common.constant;

import com.cusc.nirvana.user.exception.CuscUserException;
import com.cusc.nirvana.user.rnr.fp.handler.VinCardCheckMessageHandler;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author stayAnd
 * @date 2022/5/17
 */
@AllArgsConstructor
@Getter
public enum VinCardCheckBussinessDetailType {
	/**
	 * 业务类型
	 * 1：自然人实名-新车主
	 * 2: 自然人实名-二手车新车主
	 * 3:企业实名
	 * 4:车企实名
	 * 5:一车多卡绑定
	 * 6:卡解绑-原车主解绑
	 * 7：卡解绑-二手车解绑
	 * 8：换件
	 * 9：车企实名解绑
	 */
	NATURALPERSON_NEW(1,"自然人实名-新车主","checkVinExistCheckHandler",""),
	NATURALPERSON_SECOND(2,"自然人实名-二手车新车主","","commonUnBindVinCardCheckHandler"),
	ENTERPRISE(3,"企业实名","checkVinExistCheckHandler",""),
	VEHICLE(4,"车企实名","checkVinExistCheckHandler",""),
	ONECAR_MORECARD(5,"一车多卡绑定","checkVinNotExistCheckHandler",""),
	UNBIND_ORIGINAL(6,"卡解绑-原车主解绑","","commonUnBindVinCardCheckHandler"),
	UNBIND_SECOND(7,"卡解绑-二手车解绑","","commonUnBindVinCardCheckHandler"),
	CHANGE_BOX(8,"换件","commonBindVinCardCheckHandler","commonUnBindVinCardCheckHandler"),
	UNBIND_VEHICLE(9,"车企实名解绑","","commonUnBindVinCardCheckHandler")
	;

	private Integer type;

	private String descprition;

	/**
	 * 绑定业务 车卡关系校验的实现服务名称
	 */
	private String bindVinCardCheckHandlerName;

	/**
	 * 解绑业务 车卡关系校验的实现服务名称
	 */
	private String unBindVinCardCheckHandlerName;



	public static VinCardCheckBussinessDetailType getBytype(Integer businessType) {
		return Arrays.stream(VinCardCheckBussinessDetailType.values())
				.filter(businessDetail->businessDetail.getType().equals(businessType))
				.findFirst()
				.orElseThrow(()->new CuscUserException("","未查询到对应的业务类型:"+businessType));
	}
}
