package com.birbit.android.jobqueue.examples.twitter.dao;

import java.util.Map;

import com.birbit.android.jobqueue.examples.twitter.entities.Tweet;
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;

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

/**
 * {@inheritDoc}
 *
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig tweetDaoConfig;

    private final TweetDao tweetDao;

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

        tweetDaoConfig = daoConfigMap.get(TweetDao.class).clone();
        tweetDaoConfig.initIdentityScope(type);

        tweetDao = new TweetDao(tweetDaoConfig, this);

        registerDao(Tweet.class, tweetDao);
    }

    public void clear() {
        tweetDaoConfig.getIdentityScope().clear();
    }

    public void deleteAllData() {
        tweetDao.deleteAll();
    }


    public TweetDao getTweetDao() {
        return tweetDao;
    }

}
