package cn.net.caoyao.cpzshandset.service.presenter.tools;

import android.content.Context;
import android.content.Intent;
import cn.net.caoyao.cpzshandset.common.config.HandsetVersionConstant;
import cn.net.caoyao.cpzshandset.db.dal.common.CommonUnPackDal;
import cn.net.caoyao.cpzshandset.db.dal.commonEgg.CommonEggUnPackDal;
import cn.net.caoyao.cpzshandset.db.dal.commonfarmers.CommonFarmersUnPackDal;
import cn.net.caoyao.cpzshandset.db.presenter.UnPackDal;
import cn.net.caoyao.cpzshandset.service.presenter.UnpackConstact;
import cn.net.caoyao.cpzshandset.service.presenter.impl.unpack.common.CommonUnpackPresenter;
import cn.net.caoyao.cpzshandset.service.presenter.impl.unpack.commonEgg.CommonEggUnpackPresenter;
import cn.net.caoyao.cpzshandset.service.presenter.impl.unpack.commonfarmers.CommonFarmersUnpackPresenter;

public class UnPackConfigCreateTools {
	/**
	 * 获取拆包的dal
	 * @param cacheG
	 * @param context
	 * @return
	 */
	public UnPackDal createUnPackDal(int handsetVersionMode, Context context) {
		UnPackDal dal = null;

		switch (handsetVersionMode) {
		case HandsetVersionConstant.HANDSET_UNIVERSAL_VERSION_MODE:
			// 通用版
			dal = new CommonUnPackDal(context);
			break;
		case HandsetVersionConstant.HANDSET_RICE_VERSION_MODE:
			// 大米
			break;
		case HandsetVersionConstant.HANDSET_HOLOTHURIAN_VERSION_MODE:
			// 海参
			break;
		case HandsetVersionConstant.HANDSET_WINE_TERMINAL_VERSION_MODE:
			// 酒终端
			break;
		case HandsetVersionConstant.HANDSET_WINE_DEALER_VERSION_MODE:
			// 酒经销商
			break;
		case HandsetVersionConstant.HANDSET_FIRE_EXTINGUISHER_VERSION_MODE:
			// 灭火器
			break;
		case HandsetVersionConstant.HANDSET_AGRICULTURAL_PRODUCTS_VERSION_MODE:
			// 农产品
			break;
		case HandsetVersionConstant.HANDSET_SEED_VERSION_MODE:
			// 种子
			break;
		case HandsetVersionConstant.HANDSET_YTH_VERSION_MODE:
			// 云天化
			break;
		case HandsetVersionConstant.HANDSET_UNIVERSAL_EGG_VERSION_MODE:
			// 通用鸡蛋版
			dal = new CommonEggUnPackDal(context);
			break;
		case HandsetVersionConstant.HANDSET_UNIVERSAL_VERSION_MODE_FARMERS:
			// 通用版养殖户
			dal = new CommonFarmersUnPackDal(context);
			break;	
		}
		return dal;
	}
	
	/**
	 * 获取拆包信息的presenter
	 * @param cacheG
	 * @param context
	 * @param hisView
	 * @param intent
	 * @return
	 */
	public UnpackConstact.Presenter createUnPackInfoPresenter(int handsetVersionMode, Context context,
			UnpackConstact.View pView, Intent intent) {
		UnpackConstact.Presenter presenter = null;

		switch (handsetVersionMode) {
		case HandsetVersionConstant.HANDSET_UNIVERSAL_VERSION_MODE:
			// 通用版
			presenter = new CommonUnpackPresenter(pView, context);
			break;
		case HandsetVersionConstant.HANDSET_RICE_VERSION_MODE:
			// 大米
			break;
		case HandsetVersionConstant.HANDSET_HOLOTHURIAN_VERSION_MODE:
			// 海参
			break;
		case HandsetVersionConstant.HANDSET_WINE_TERMINAL_VERSION_MODE:
			// 酒终端
			break;
		case HandsetVersionConstant.HANDSET_WINE_DEALER_VERSION_MODE:
			// 酒经销商
			break;
		case HandsetVersionConstant.HANDSET_FIRE_EXTINGUISHER_VERSION_MODE:
			// 灭火器
			break;
		case HandsetVersionConstant.HANDSET_AGRICULTURAL_PRODUCTS_VERSION_MODE:
			// 农产品
			break;
		case HandsetVersionConstant.HANDSET_SEED_VERSION_MODE:
			// 种子
			break;
		case HandsetVersionConstant.HANDSET_YTH_VERSION_MODE:
			// 云天化
			break;
		case HandsetVersionConstant.HANDSET_UNIVERSAL_EGG_VERSION_MODE:
			// 通用鸡蛋版
			presenter = new CommonEggUnpackPresenter(pView, context);
			break;
		case HandsetVersionConstant.HANDSET_UNIVERSAL_VERSION_MODE_FARMERS:
			// 通用版
			presenter = new CommonFarmersUnpackPresenter(pView, context);
			break;	
		}
		return presenter;
	}
}
