import { WebhookServer } from './src/server';
import { initializeDatabase, db } from './src/db';

console.log("Starting WhatsApp Task Bot...");
try {
  // Initialize database first
  initializeDatabase(db);
  console.log("✅ Database initialized");

  // Then start server
  const server = WebhookServer.start();
  console.log("Server started successfully");
} catch (error) {
  console.error("Failed to start server:", error);
  process.exit(1);
}

export default WebhookServer;
