var Db        = require('./db');
var Crud      = require('./crud');
var Migrate   = require('./migrate');

module.exports = function(options) {
  var db = Db(options)
    , crud = Crud(db, options)
    , migrate = Migrate(db, options);

  return {
    database: options.db.database,

    db: db.db,
    query: db.query,

    load: crud.load,
    save: crud.save,
    remove: crud.remove,
    count: crud.count,

    generate: migrate.generate,

    getTables: migrate.getTables,
    getSchema: migrate.getSchema,
    getIndexes: migrate.getIndexes,

    alterTable: migrate.alterTable,
    indexTable: migrate.indexTable,
    addTable: migrate.addTable,
    dropTables: migrate.dropTables
  };
};
