import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { setupProjectManagementTools } from './tools.js';
import { getToolRegistry } from '../../core/tool-framework.js';

/**
 * Project Management Module Setup - 12-Factor MCP
 * 
 * This module handles:
 * - Project initialization and configuration
 * - Project status checking and discovery
 * - Project removal and cleanup
 * - Project configuration management
 */
export async function setupProjectManagement(server: Server) {
  // Register tools with the global registry
  const registry = getToolRegistry();
  const toolRegistration = await setupProjectManagementTools();
  registry.registerModule(toolRegistration);

  console.log('✅ Project Management module initialized with SQLite backend');
  
  return {
    tools: toolRegistration.tools.map(tool => ({
      name: `project-management.${tool.name}`,
      description: tool.description,
      inputSchema: tool.inputSchema
    })),
    resources: []
  };
}

// Export for backward compatibility
export const setupProjectManagementTools_New = setupProjectManagement;