package cn.net.caoyao.cpzshandset.service.presenter.impl.upload.commonEgg;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;

import cn.net.caoyao.cpzshandset.common.config.HandsetOperation;
import cn.net.caoyao.cpzshandset.service.bll.UploadStatusBll;
import cn.net.caoyao.cpzshandset.service.presenter.UploadStatusConstact;
import cn.net.caoyao.cpzshandset.service.presenter.base.impl.UploadStatusConstactImpl;
import cn.net.caoyao.cpzshandset.ui.adapter.UploadStatusAdapter;

public class CommonEggUploadStatusPresenter extends UploadStatusConstactImpl{

	private final UploadStatusConstact.View uView;
	private Context context;
	private List<String> dates = new ArrayList<>();
//	private List<HomeBean> homeBeans = new ArrayList<>();
	private List<HandsetOperation> options = new ArrayList<>();
	private UploadStatusBll uploadStatusBll;
	public CommonEggUploadStatusPresenter(UploadStatusConstact.View uView,Context context) {
		this.uView = uView;
		this.context = context;
		start();
	}
	
	@Override
	public void start() {
		if (!checkViewAvailable()) return;
		init();
		uView.setPageTitle("提交状态");
		uView.setAdapter(new UploadStatusAdapter(dates, options, uploadStatusBll));
	}

	private void init() {
		uploadStatusBll = new UploadStatusBll(context);
		HandsetOperation.OPERATION_ACTIVATE_WITH_PACK_CONSTANT.setOptionName("生产打包");
		options.add(HandsetOperation.OPERATION_ACTIVATE_WITH_PACK_CONSTANT);
		options.add(HandsetOperation.OPERATION_ACTIVATE_CONSTANT);
		options.add(HandsetOperation.OPERATION_PACK_CONSTANT);
		options.add(HandsetOperation.OPERATION_UNPACK_CONSTANT);
		options.add(HandsetOperation.OPERATION_OUT_WAREHOUSE_CONSTANT);
		options.add(HandsetOperation.OPERATION_IN_WAREHOUSE_CONSTANT);
		options.add(HandsetOperation.OPERATION_BACK_WAREHOUSE_CONSTANT);
		options.add(HandsetOperation.OPERATION_SALE_CONSTANT);
		
		
		dates = uploadStatusBll.queryUploadDateFor7Days();
//		LogUtil.d(TConfig.Echo, "提交状态：" + dates.toString());
	}

	@Override
	public boolean checkViewAvailable() {
		boolean b = false;
        if (uView != null && context != null) {
            b = true;
        }
        return b;
	}

	


}
