import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  app.enableCors();
  app.setGlobalPrefix('api/v1');

  const port = process.env.PORT || 3001;
  await app.listen(port);

  console.log(`\n🚀 Server running on http://localhost:${port}`);
  console.log(`\n--- Public routes ---`);
  console.log(`  GET  http://localhost:${port}/api/v1/health`);
  console.log(`  POST http://localhost:${port}/api/v1/auth/register`);
  console.log(`  POST http://localhost:${port}/api/v1/auth/login`);
  
  
  console.log(`\n--- Protected routes (require Bearer token) ---`);
  console.log(`  GET  http://localhost:${port}/api/v1/games`);
  console.log(`  GET  http://localhost:${port}/api/v1/games/:gameName/config`);
  console.log(`  GET  http://localhost:${port}/api/v1/games/:gameName/symbols`);
  console.log(`  GET  http://localhost:${port}/api/v1/games/:gameName/paytable`);
  console.log(`  GET  http://localhost:${port}/api/v1/games/:gameName/grid`);
  console.log(`  GET  http://localhost:${port}/api/v1/games/:gameName/rules`);
  console.log(`  GET  http://localhost:${port}/api/v1/games/:gameName/options`);
  console.log(`  GET  http://localhost:${port}/api/v1/games/:gameName/states`);
  console.log(`  GET  http://localhost:${port}/api/v1/games/:gameName/wintypes`);
  console.log(`  GET  http://localhost:${port}/api/v1/games/:gameName/mechanics`);
  console.log(`  GET  http://localhost:${port}/api/v1/games/:gameName/modes\n`);
}

bootstrap();
