package com.sunzee.db;

import com.sunzee.model.domain.LocalOrderBean;
import com.sunzee.model.domain.OrderBean;
import com.sunzee.model.domain.WarringBean;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import java.util.Map;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig localOrderBeanDaoConfig;
    private final DaoConfig orderBeanDaoConfig;
    private final DaoConfig warringBeanDaoConfig;

    private final LocalOrderBeanDao localOrderBeanDao;
    private final OrderBeanDao orderBeanDao;
    private final WarringBeanDao warringBeanDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        localOrderBeanDaoConfig = daoConfigMap.get(LocalOrderBeanDao.class).clone();
        localOrderBeanDaoConfig.initIdentityScope(type);

        orderBeanDaoConfig = daoConfigMap.get(OrderBeanDao.class).clone();
        orderBeanDaoConfig.initIdentityScope(type);

        warringBeanDaoConfig = daoConfigMap.get(WarringBeanDao.class).clone();
        warringBeanDaoConfig.initIdentityScope(type);

        localOrderBeanDao = new LocalOrderBeanDao(localOrderBeanDaoConfig, this);
        orderBeanDao = new OrderBeanDao(orderBeanDaoConfig, this);
        warringBeanDao = new WarringBeanDao(warringBeanDaoConfig, this);

        registerDao(LocalOrderBean.class, localOrderBeanDao);
        registerDao(OrderBean.class, orderBeanDao);
        registerDao(WarringBean.class, warringBeanDao);
    }
    
    public void clear() {
        localOrderBeanDaoConfig.clearIdentityScope();
        orderBeanDaoConfig.clearIdentityScope();
        warringBeanDaoConfig.clearIdentityScope();
    }

    public LocalOrderBeanDao getLocalOrderBeanDao() {
        return localOrderBeanDao;
    }

    public OrderBeanDao getOrderBeanDao() {
        return orderBeanDao;
    }

    public WarringBeanDao getWarringBeanDao() {
        return warringBeanDao;
    }

}
