package cn.net.caoyao.cpzshandset.service.bll;

import java.util.List;

import android.content.Context;

import cn.net.caoyao.cpzshandset.bean.PackSubLabelInfoBean;
import cn.net.caoyao.cpzshandset.common.config.ConfigCreateService;
import cn.net.caoyao.cpzshandset.common.util.CacheGet;
import cn.net.caoyao.cpzshandset.db.presenter.PackSubLabelDal;

public class PackSubLabelBll {
	private PackSubLabelDal dal;
	public PackSubLabelBll(Context context) {
//		dal = new CommonPackSubLabelDal(context);
		ConfigCreateService service = new ConfigCreateService();
		dal = service.createPackSubDal(new CacheGet(),context);
	}
	public void insertPackSubLabel(PackSubLabelInfoBean b) {
		if(dal == null || b == null) return;
		dal.insertPackSubLabel(b);
	}

	
	public List<PackSubLabelInfoBean> queryAllSubLabelByPackageId(int packageId,int option_id,int option_type) {
		if(dal == null) return null;
		
		return dal.queryAllSubLabelByPackageId(packageId,option_id, option_type);
	}

	public List<String> queryAllSubLabelStrByPackageId(int packageId,int option_id,int option_type) {
		if(dal == null) return null;
		
		return dal.queryAllSubLabelStrByPackageId(packageId,option_id, option_type);
	}
	public void deletePackLabelById(int id) {
		if(dal == null) return;
		dal.deletePackLabelById(id);
	}

	
	public boolean hasExistActivateLabel(String labelId) {
		if(dal == null) return false;
		return dal.hasExistActivateLabel(labelId);
	}

	
	public boolean hasExistSubPackLabel(String labelId) {
		if(dal == null) return false;
		return dal.hasExistSubPackLabel(labelId);
	}
	public boolean hasExistSubPackLabelInPackageId(String labelId, int packageId) {
		if(dal == null) return false;
		return dal.hasExistSubPackLabelInPackageId(labelId, packageId);
	}
	public void updateLabelStatus(String labelId, int option_id, int option_type, int status) {
		if(dal == null || labelId == null) return;
		dal.updateLabelStatus(labelId, option_id, option_type, status);
	}

	
	public void updateLabelListStatus(List<String> labels, int packageId,int option_id, int option_type, int status) {
		if(dal == null || labels == null) return;
		dal.updateLabelListStatus(labels, packageId,option_id, option_type, status);
	}
	
	public int queryLabelCountByOptionId(int option_id, int option_type) {
		if(dal == null) return 0;
		return dal.queryLabelCountByOptionId(option_id, option_type);
	}
	
	public int queryLabelCountByPackageId(int packageId) {
		if(dal == null) return 0;
		return dal.queryLabelCountByPackageId(packageId);
	}
}
