package com.adins.mss.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.util.Log;

import de.greenrobot.dao.AbstractDaoMaster;
import de.greenrobot.dao.database.StandardDatabase;
import de.greenrobot.dao.database.Database;
import de.greenrobot.dao.database.EncryptedDatabaseOpenHelper;
import de.greenrobot.dao.database.DatabaseOpenHelper;
import de.greenrobot.dao.identityscope.IdentityScopeType;

import com.adins.mss.dao.CollectionActivityDao;
import com.adins.mss.dao.InstallmentScheduleDao;
import com.adins.mss.dao.MobileDataFileDao;
import com.adins.mss.dao.GeneralParameterDao;
import com.adins.mss.dao.GroupUserDao;
import com.adins.mss.dao.LookupDao;
import com.adins.mss.dao.SyncDao;
import com.adins.mss.dao.MenuDao;
import com.adins.mss.dao.PrintItemDao;
import com.adins.mss.dao.QuestionSetDao;
import com.adins.mss.dao.SchemeDao;
import com.adins.mss.dao.TimelineTypeDao;
import com.adins.mss.dao.UserDao;
import com.adins.mss.dao.KompetisiDao;
import com.adins.mss.dao.LoggerDao;
import com.adins.mss.dao.CollectionHistoryDao;
import com.adins.mss.dao.CommentDao;
import com.adins.mss.dao.DepositReportDDao;
import com.adins.mss.dao.DepositReportHDao;
import com.adins.mss.dao.ImageResultDao;
import com.adins.mss.dao.LocationInfoDao;
import com.adins.mss.dao.MessageDao;
import com.adins.mss.dao.PaymentHistoryDDao;
import com.adins.mss.dao.PaymentHistoryHDao;
import com.adins.mss.dao.PaymentChannelDao;
import com.adins.mss.dao.PrintResultDao;
import com.adins.mss.dao.ReceiptVoucherDao;
import com.adins.mss.dao.TaskSummaryDao;
import com.adins.mss.dao.TaskDDao;
import com.adins.mss.dao.TaskHDao;
import com.adins.mss.dao.TaskHSequenceDao;
import com.adins.mss.dao.PlanTaskDao;
import com.adins.mss.dao.TimelineDao;
import com.adins.mss.dao.MobileContentDDao;
import com.adins.mss.dao.MobileContentHDao;
import com.adins.mss.dao.HolidayDao;
import com.adins.mss.dao.PrintDateDao;
import com.adins.mss.dao.ErrorLogDao;
import com.adins.mss.dao.AccountDao;
import com.adins.mss.dao.ProductDao;
import com.adins.mss.dao.ContactDao;
import com.adins.mss.dao.GroupTaskDao;
import com.adins.mss.dao.CatalogueDao;
import com.adins.mss.dao.ThemeItemDao;
import com.adins.mss.dao.ThemeDao;
import com.adins.mss.dao.LogoPrintDao;
import com.adins.mss.dao.EmergencyDao;
import com.adins.mss.dao.LastSyncDao;
import com.adins.mss.dao.BankAccountOfBranchDao;
import com.adins.mss.dao.BroadcastDao;
import com.adins.mss.dao.ReceiptHistoryDao;
import com.adins.mss.migration.MigrationV12toV13;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * Master of DAO (schema version 13): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
    public static final int SCHEMA_VERSION = 13;

    /** Creates underlying database table using DAOs. */
    public static void createAllTables(Database db, boolean ifNotExists) {
        CollectionActivityDao.createTable(db, ifNotExists);
        InstallmentScheduleDao.createTable(db, ifNotExists);
        MobileDataFileDao.createTable(db, ifNotExists);
        GeneralParameterDao.createTable(db, ifNotExists);
        GroupUserDao.createTable(db, ifNotExists);
        LookupDao.createTable(db, ifNotExists);
        SyncDao.createTable(db, ifNotExists);
        MenuDao.createTable(db, ifNotExists);
        PrintItemDao.createTable(db, ifNotExists);
        QuestionSetDao.createTable(db, ifNotExists);
        SchemeDao.createTable(db, ifNotExists);
        TimelineTypeDao.createTable(db, ifNotExists);
        UserDao.createTable(db, ifNotExists);
        KompetisiDao.createTable(db, ifNotExists);
        LoggerDao.createTable(db, ifNotExists);
        CollectionHistoryDao.createTable(db, ifNotExists);
        CommentDao.createTable(db, ifNotExists);
        DepositReportDDao.createTable(db, ifNotExists);
        DepositReportHDao.createTable(db, ifNotExists);
        ImageResultDao.createTable(db, ifNotExists);
        LocationInfoDao.createTable(db, ifNotExists);
        MessageDao.createTable(db, ifNotExists);
        PaymentHistoryDDao.createTable(db, ifNotExists);
        PaymentHistoryHDao.createTable(db, ifNotExists);
        PaymentChannelDao.createTable(db, ifNotExists);
        PrintResultDao.createTable(db, ifNotExists);
        ReceiptVoucherDao.createTable(db, ifNotExists);
        TaskSummaryDao.createTable(db, ifNotExists);
        TaskDDao.createTable(db, ifNotExists);
        TaskHDao.createTable(db, ifNotExists);
        TaskHSequenceDao.createTable(db, ifNotExists);
        PlanTaskDao.createTable(db, ifNotExists);
        TimelineDao.createTable(db, ifNotExists);
        MobileContentDDao.createTable(db, ifNotExists);
        MobileContentHDao.createTable(db, ifNotExists);
        HolidayDao.createTable(db, ifNotExists);
        PrintDateDao.createTable(db, ifNotExists);
        ErrorLogDao.createTable(db, ifNotExists);
        AccountDao.createTable(db, ifNotExists);
        ProductDao.createTable(db, ifNotExists);
        ContactDao.createTable(db, ifNotExists);
        GroupTaskDao.createTable(db, ifNotExists);
        CatalogueDao.createTable(db, ifNotExists);
        ThemeItemDao.createTable(db, ifNotExists);
        ThemeDao.createTable(db, ifNotExists);
        LogoPrintDao.createTable(db, ifNotExists);
        EmergencyDao.createTable(db, ifNotExists);
        LastSyncDao.createTable(db, ifNotExists);
        BankAccountOfBranchDao.createTable(db, ifNotExists);
        BroadcastDao.createTable(db, ifNotExists);
        ReceiptHistoryDao.createTable(db, ifNotExists);
    }
    
    /** Drops underlying database table using DAOs. */
    public static void dropAllTables(Database db, boolean ifExists) {
        CollectionActivityDao.dropTable(db, ifExists);
        InstallmentScheduleDao.dropTable(db, ifExists);
        MobileDataFileDao.dropTable(db, ifExists);
        GeneralParameterDao.dropTable(db, ifExists);
        GroupUserDao.dropTable(db, ifExists);
        LookupDao.dropTable(db, ifExists);
        SyncDao.dropTable(db, ifExists);
        MenuDao.dropTable(db, ifExists);
        PrintItemDao.dropTable(db, ifExists);
        QuestionSetDao.dropTable(db, ifExists);
        SchemeDao.dropTable(db, ifExists);
        TimelineTypeDao.dropTable(db, ifExists);
        UserDao.dropTable(db, ifExists);
        KompetisiDao.dropTable(db, ifExists);
        LoggerDao.dropTable(db, ifExists);
        CollectionHistoryDao.dropTable(db, ifExists);
        CommentDao.dropTable(db, ifExists);
        DepositReportDDao.dropTable(db, ifExists);
        DepositReportHDao.dropTable(db, ifExists);
        ImageResultDao.dropTable(db, ifExists);
        LocationInfoDao.dropTable(db, ifExists);
        MessageDao.dropTable(db, ifExists);
        PaymentHistoryDDao.dropTable(db, ifExists);
        PaymentHistoryHDao.dropTable(db, ifExists);
        PaymentChannelDao.dropTable(db, ifExists);
        PrintResultDao.dropTable(db, ifExists);
        ReceiptVoucherDao.dropTable(db, ifExists);
        TaskSummaryDao.dropTable(db, ifExists);
        TaskDDao.dropTable(db, ifExists);
        TaskHDao.dropTable(db, ifExists);
        TaskHSequenceDao.dropTable(db, ifExists);
        PlanTaskDao.dropTable(db, ifExists);
        TimelineDao.dropTable(db, ifExists);
        MobileContentDDao.dropTable(db, ifExists);
        MobileContentHDao.dropTable(db, ifExists);
        HolidayDao.dropTable(db, ifExists);
        PrintDateDao.dropTable(db, ifExists);
        ErrorLogDao.dropTable(db, ifExists);
        AccountDao.dropTable(db, ifExists);
        ProductDao.dropTable(db, ifExists);
        ContactDao.dropTable(db, ifExists);
        GroupTaskDao.dropTable(db, ifExists);
        CatalogueDao.dropTable(db, ifExists);
        ThemeItemDao.dropTable(db, ifExists);
        ThemeDao.dropTable(db, ifExists);
        LogoPrintDao.dropTable(db, ifExists);
        EmergencyDao.dropTable(db, ifExists);
        LastSyncDao.dropTable(db, ifExists);
        BankAccountOfBranchDao.dropTable(db, ifExists);
        BroadcastDao.dropTable(db, ifExists);
        ReceiptHistoryDao.dropTable(db, ifExists);
    }
    
    public static abstract class OpenHelper extends DatabaseOpenHelper {
        public OpenHelper(Context context, String name) {
            super(context, name, SCHEMA_VERSION);
        }
        public OpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory, SCHEMA_VERSION);
        }

        @Override
        public void onCreate(Database db) {
            Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
            createAllTables(db, false);
        }
    }
    
    /** WARNING: Drops all table on Upgrade! Use only during development. */
    public static class DevOpenHelper extends OpenHelper {
        public DevOpenHelper(Context context, String name) {
            super(context, name);
        }

        @Override
        public void onUpgrade(Database db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            MigrationV12toV13.execute(db, oldVersion);
        }
    }

    public static abstract class EncryptedOpenHelper extends EncryptedDatabaseOpenHelper {
        public EncryptedOpenHelper(Context context, String name) {
            super(context, name, SCHEMA_VERSION);
        }

        public EncryptedOpenHelper(Context context, String name, Object cursorFactory, boolean loadNativeLibs) {
            super(context, name, cursorFactory, SCHEMA_VERSION, loadNativeLibs);
        }

        @Override
        public void onCreate(Database db) {
            Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
            createAllTables(db, false);
        }
    }

    /** WARNING: Drops all table on Upgrade! Use only during development. */
    public static class EncryptedDevOpenHelper extends EncryptedOpenHelper {
        public EncryptedDevOpenHelper(Context context, String name) {
            super(context, name);
        }

        public EncryptedDevOpenHelper(Context context, String name, Object cursorFactory, boolean loadNativeLibs) {
            super(context, name, cursorFactory, loadNativeLibs);
        }

        @Override
        public void onUpgrade(Database db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            MigrationV12toV13.execute(db, oldVersion);
        }
    }

    public DaoMaster(SQLiteDatabase db) {
        this(new StandardDatabase(db));
    }

    public DaoMaster(Database db) {
        super(db, SCHEMA_VERSION);
        registerDaoClass(CollectionActivityDao.class);
        registerDaoClass(InstallmentScheduleDao.class);
        registerDaoClass(MobileDataFileDao.class);
        registerDaoClass(GeneralParameterDao.class);
        registerDaoClass(GroupUserDao.class);
        registerDaoClass(LookupDao.class);
        registerDaoClass(SyncDao.class);
        registerDaoClass(MenuDao.class);
        registerDaoClass(PrintItemDao.class);
        registerDaoClass(QuestionSetDao.class);
        registerDaoClass(SchemeDao.class);
        registerDaoClass(TimelineTypeDao.class);
        registerDaoClass(UserDao.class);
        registerDaoClass(KompetisiDao.class);
        registerDaoClass(LoggerDao.class);
        registerDaoClass(CollectionHistoryDao.class);
        registerDaoClass(CommentDao.class);
        registerDaoClass(DepositReportDDao.class);
        registerDaoClass(DepositReportHDao.class);
        registerDaoClass(ImageResultDao.class);
        registerDaoClass(LocationInfoDao.class);
        registerDaoClass(MessageDao.class);
        registerDaoClass(PaymentHistoryDDao.class);
        registerDaoClass(PaymentHistoryHDao.class);
        registerDaoClass(PaymentChannelDao.class);
        registerDaoClass(PrintResultDao.class);
        registerDaoClass(ReceiptVoucherDao.class);
        registerDaoClass(TaskSummaryDao.class);
        registerDaoClass(TaskDDao.class);
        registerDaoClass(TaskHDao.class);
        registerDaoClass(TaskHSequenceDao.class);
        registerDaoClass(PlanTaskDao.class);
        registerDaoClass(TimelineDao.class);
        registerDaoClass(MobileContentDDao.class);
        registerDaoClass(MobileContentHDao.class);
        registerDaoClass(HolidayDao.class);
        registerDaoClass(PrintDateDao.class);
        registerDaoClass(ErrorLogDao.class);
        registerDaoClass(AccountDao.class);
        registerDaoClass(ProductDao.class);
        registerDaoClass(ContactDao.class);
        registerDaoClass(GroupTaskDao.class);
        registerDaoClass(CatalogueDao.class);
        registerDaoClass(ThemeItemDao.class);
        registerDaoClass(ThemeDao.class);
        registerDaoClass(LogoPrintDao.class);
        registerDaoClass(EmergencyDao.class);
        registerDaoClass(LastSyncDao.class);
        registerDaoClass(BankAccountOfBranchDao.class);
        registerDaoClass(BroadcastDao.class);
        registerDaoClass(ReceiptHistoryDao.class);
    }
    
    public DaoSession newSession() {
        return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
    }
    
    public DaoSession newSession(IdentityScopeType type) {
        return new DaoSession(db, type, daoConfigMap);
    }
    
}
