// ABOUTME: Routes registration module
// ABOUTME: Mounts all API route handlers onto the Express app

import { Express } from 'express';
import { PrismaClient } from '@prisma/client';
import logger from '../utils/logger';
import { createMeetingsRouter } from './meetings';
import { createRacesRouter } from './races';

/**
 * Register all REST API routes on the Express application.
 * Must be called after the app is created and before the server listens.
 */
export function registerRoutes(app: Express, prisma: PrismaClient): void {
  logger.info('Registering API routes');

  // Mount meetings routes at /api/meetings
  app.use('/api/meetings', createMeetingsRouter(prisma));

  // Mount races routes at /api/races
  app.use('/api/races', createRacesRouter(prisma));

  logger.info('API routes registered successfully');
}
