package com.yc.ship.module.trade.framework.common.ota;



import com.yc.ship.module.trade.enums.ota.AliTripCode;
import com.yc.ship.module.trade.enums.ota.MeiTuanUSGroupCode;
import com.yc.ship.module.trade.enums.ota.QunarCode;
import com.yc.ship.module.trade.enums.ota.XieChengCode;
import org.apache.commons.lang3.StringUtils;

import static com.yc.ship.module.trade.enums.ApiConstants.*;
import static com.yc.ship.module.trade.enums.ota.OtaConstants.*;


/**
 * 证件类型转换
 * @author le'yang
 */
public class DocTypeHandler {
	
	/**
	 * 根据分销商证件类型转换为我方证件类型
	 * @param customerId
	 * @param docType
	 * @return
	 * @author zhoulonggui
	 * @date 2017年8月24日
	 */
	public static String changeDocType(int customerId, String docType){
		if(StringUtils.isNoneEmpty(docType)||"0".equals(docType)){
			return DOC_TYPE_IDCARD;
		}
		String type = DOC_TYPE_OTHER;
		 if(SYS_PRI_KEY_US_GROUP==customerId){// 5美团
			if(MeiTuanUSGroupCode.USGROUP_DOC_TYPE_GANGOAO_PASS.equals(docType)){
				type = DOC_TYPE_GANGAO;
			}else if(MeiTuanUSGroupCode.USGROUP_DOC_TYPE_IDCARD.equals(docType)){
				type = DOC_TYPE_IDCARD;
			}else if(MeiTuanUSGroupCode.USGROUP_DOC_TYPE_JUNGUAN.equals(docType)){
				//type = DOC_TYPE_SOLDIER_CARD;
			}else if(MeiTuanUSGroupCode.USGROUP_DOC_TYPE_PASSPORT.equals(docType)){
				type = DOC_TYPE_PASSPORT;
			}else if(MeiTuanUSGroupCode.USGROUP_DOC_TYPE_TAIBAO.equals(docType)){
				//type = DOC_TYPE_TAIBAO;
			}else if(MeiTuanUSGroupCode.USGROUP_DOC_TYPE_TAIWAN_PASS.equals(docType)){
				type = DOC_TYPE_TAIWAN_PASS;
			}
		}else if(SYS_PRI_KEY_SAME_WAY==customerId){// 6同程
			// 默认只支持身份证 2017.8.24
			type = DOC_TYPE_IDCARD;
		}else if(SYS_PRI_KEY_QUNAR==customerId){// 7去哪儿
			if(QunarCode.QUNAR_DOC_TYPE_GANGAO.equals(docType)){
				type = DOC_TYPE_GANGAO;
			}else if(QunarCode.QUNAR_DOC_TYPE_IDCARD.equals(docType)){
				type = DOC_TYPE_IDCARD;
			}else if(QunarCode.QUNAR_DOC_TYPE_PASSPORT.equals(docType)){
				type = DOC_TYPE_PASSPORT;
			}else if(QunarCode.QUNAR_DOC_TYPE_TAIBAO.equals(docType)){
				//type = DOC_TYPE_TAIBAO;
			}
		}else if(SYS_PRI_KEY_ALITRIP==customerId){// 31飞猪
			if(AliTripCode.ALITRIP_DOC_TYPE_IDCARD.equals(docType)){
				type = DOC_TYPE_IDCARD;
			}else if(AliTripCode.ALITRIP_DOC_TYPE_PASSPORT.equals(docType)){
				type = DOC_TYPE_PASSPORT;
			}else if(AliTripCode.ALITRIP_DOC_TYPE_STUDENT_CARD.equals(docType)){
				//type = DOC_TYPE_STU_CARD;
			}else if(AliTripCode.ALITRIP_DOC_TYPE_JUNGUAN_CARD.equals(docType)){
				//type = DOC_TYPE_SOLDIER_CARD;
			}else if(AliTripCode.ALITRIP_DOC_TYPE_BACK.equals(docType)){
				//type = DOC_TYPE_HUIXIANG_CARD;
			}else if(AliTripCode.ALITRIP_DOC_TYPE_TAIBAO.equals(docType)){
				//type = DOC_TYPE_TAIBAO;
			}else if(AliTripCode.ALITRIP_DOC_TYPE_GANGAO.equals(docType)){
				type = DOC_TYPE_GANGAO;
			}else if(AliTripCode.ALITRIP_DOC_TYPE_POLICE_CARD.equals(docType)){
				type = DOC_TYPE_OTHER;
			}else if(AliTripCode.ALITRIP_DOC_TYPE_SOLDIER_CARD.equals(docType)){
				type = DOC_TYPE_OTHER;
			}else if(AliTripCode.ALITRIP_DOC_TYPE_TAIWAN_CARD.equals(docType)){
				type = DOC_TYPE_TAIWAN_PASS;
			}
		}else if(SYS_PRI_KEY_CTRIP==customerId|| SYS_PRI_KEY_CTRIP_JSON_V2==customerId){// 8 携程
			if(XieChengCode.XC_DOC_TYPE_IDCARD.equals(docType)){
				type = DOC_TYPE_IDCARD;
			}else if(XieChengCode.XC_DOC_TYPE_PASSPORT.equals(docType)){
				type = DOC_TYPE_PASSPORT;
			}else if(XieChengCode.XC_DOC_TYPE_STU_CARD.equals(docType)){
				//type = DOC_TYPE_STU_CARD;
			}else if(XieChengCode.XC_DOC_TYPE_SOLDIER_CARD.equals(docType)){
				//type = DOC_TYPE_SOLDIER_CARD;
			}else if(XieChengCode.XC_DOC_TYPE_DRIVER_LICENSE.equals(docType)){
				//type = DOC_TYPE_DRIVER_LICENSE;
			}else if(XieChengCode.XC_DOC_TYPE_HUIXIANG_CARD.equals(docType)){
				//type = DOC_TYPE_HUIXIANG_CARD;
			}else if(XieChengCode.XC_DOC_TYPE_TAIBAO.equals(docType)){
				//type = DOC_TYPE_TAIBAO;
			}else if(XieChengCode.XC_DOC_TYPE_GANGAO.equals(docType)){
				type = DOC_TYPE_GANGAO;
			}else if(XieChengCode.XC_DOC_TYPE_SEAFARERS.equals(docType)){
				//type = DOC_TYPE_SEAFARERS;
			}else if(XieChengCode.XC_DOC_TYPE_FORE_PEOPLE.equals(docType)){
				type = DOC_TYPE_FORE_PEOPLE;
			}else if(XieChengCode.XC_DOC_TYPE_TAIWAN_PASS.equals(docType)){
				type = DOC_TYPE_TAIWAN_PASS;
			}
		}
		// 默认为其他
		return type;
	}
	
}
