/**
 * Route factory for data pipeline service
 * Creates routes with access to the service container
 */

import { Hono } from 'hono';
import type { IServiceContainer } from '@stock-bot/handlers';
import { createEnhancedSyncRoutes } from './enhanced-sync.routes';
import { healthRoutes } from './health.routes';
import { createStatsRoutes } from './stats.routes';
import { createSyncRoutes } from './sync.routes';

export function createRoutes(container: IServiceContainer): Hono {
  const app = new Hono();

  // Add container to context for all routes
  app.use('*', async (c, next) => {
    c.set('container', container);
    await next();
  });

  // Mount routes
  app.route('/health', healthRoutes);
  app.route('/sync', createSyncRoutes(container));
  app.route('/sync', createEnhancedSyncRoutes(container));
  app.route('/sync/stats', createStatsRoutes(container));

  return app;
}
