/**
 * Database Tool - 数据库工具入口
 */

const connection = require('./connection');
const AccountRepository = require('./account-repository');

module.exports = {
  name: 'database',
  alias: 'db',
  description: 'MySQL数据库工具',
  
  /**
   * 初始化数据库连接
   */
  async initialize(config) {
    return await connection.initialize(config);
  },
  
  /**
   * 获取 Repository
   */
  getRepository(name) {
    const repositories = {
      account: new AccountRepository(connection)
    };
    
    return repositories[name];
  },
  
  /**
   * 关闭数据库连接
   */
  async close() {
    return await connection.close();
  }
};
