package com.raizlabs.android.databasecomparison.greendao.gen;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.raizlabs.android.databasecomparison.greendao.gen.SimpleAddressItem;
import com.raizlabs.android.databasecomparison.greendao.gen.AddressItem;
import com.raizlabs.android.databasecomparison.greendao.gen.Contact;
import com.raizlabs.android.databasecomparison.greendao.gen.AddressBook;

import com.raizlabs.android.databasecomparison.greendao.gen.SimpleAddressItemDao;
import com.raizlabs.android.databasecomparison.greendao.gen.AddressItemDao;
import com.raizlabs.android.databasecomparison.greendao.gen.ContactDao;
import com.raizlabs.android.databasecomparison.greendao.gen.AddressBookDao;

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

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

    private final DaoConfig simpleAddressItemDaoConfig;
    private final DaoConfig addressItemDaoConfig;
    private final DaoConfig contactDaoConfig;
    private final DaoConfig addressBookDaoConfig;

    private final SimpleAddressItemDao simpleAddressItemDao;
    private final AddressItemDao addressItemDao;
    private final ContactDao contactDao;
    private final AddressBookDao addressBookDao;

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

        simpleAddressItemDaoConfig = daoConfigMap.get(SimpleAddressItemDao.class).clone();
        simpleAddressItemDaoConfig.initIdentityScope(type);

        addressItemDaoConfig = daoConfigMap.get(AddressItemDao.class).clone();
        addressItemDaoConfig.initIdentityScope(type);

        contactDaoConfig = daoConfigMap.get(ContactDao.class).clone();
        contactDaoConfig.initIdentityScope(type);

        addressBookDaoConfig = daoConfigMap.get(AddressBookDao.class).clone();
        addressBookDaoConfig.initIdentityScope(type);

        simpleAddressItemDao = new SimpleAddressItemDao(simpleAddressItemDaoConfig, this);
        addressItemDao = new AddressItemDao(addressItemDaoConfig, this);
        contactDao = new ContactDao(contactDaoConfig, this);
        addressBookDao = new AddressBookDao(addressBookDaoConfig, this);

        registerDao(SimpleAddressItem.class, simpleAddressItemDao);
        registerDao(AddressItem.class, addressItemDao);
        registerDao(Contact.class, contactDao);
        registerDao(AddressBook.class, addressBookDao);
    }
    
    public void clear() {
        simpleAddressItemDaoConfig.getIdentityScope().clear();
        addressItemDaoConfig.getIdentityScope().clear();
        contactDaoConfig.getIdentityScope().clear();
        addressBookDaoConfig.getIdentityScope().clear();
    }

    public SimpleAddressItemDao getSimpleAddressItemDao() {
        return simpleAddressItemDao;
    }

    public AddressItemDao getAddressItemDao() {
        return addressItemDao;
    }

    public ContactDao getContactDao() {
        return contactDao;
    }

    public AddressBookDao getAddressBookDao() {
        return addressBookDao;
    }

}
