/**
 * Service Container Setup for Web API
 * Configures dependency injection for the web API service
 */

import type { AppConfig } from '@stock-bot/config';
import type { IServiceContainer } from '@stock-bot/handlers';
import { getLogger } from '@stock-bot/logger';

const logger = getLogger('web-api-container');

/**
 * Configure the service container for web API workloads
 */
export function setupServiceContainer(
  config: AppConfig,
  container: IServiceContainer
): IServiceContainer {
  logger.info('Configuring web API service container...');

  // Web API specific configuration
  // This service mainly reads data, so smaller pool sizes are fine
  const poolSizes = {
    mongodb: config.environment === 'production' ? 20 : 10,
    postgres: config.environment === 'production' ? 30 : 15,
    cache: config.environment === 'production' ? 20 : 10,
  };

  logger.info('Web API pool sizes configured', poolSizes);

  // The container is already configured with connections
  // Just return it with our logging
  return container;
}
