/**
 * Handler registration for data pipeline service
 */

import { getLogger } from '@stock-bot/logger';
import type { IServiceContainer } from '@stock-bot/types';
// Import handlers directly
import { ExchangesHandler } from './exchanges/exchanges.handler';
import { SymbolsHandler } from './symbols/symbols.handler';

const logger = getLogger('pipeline-handler-init');

/**
 * Initialize and register all handlers
 */
export async function initializeAllHandlers(container: IServiceContainer): Promise<void> {
  logger.info('Initializing data pipeline handlers...');

  try {
    // Register handlers manually
    const handlers = [ExchangesHandler, SymbolsHandler];

    for (const Handler of handlers) {
      try {
        const instance = new Handler(container);
        // Register the handler instance if needed
        logger.info(`Registered handler: ${Handler.name}`);
      } catch (error) {
        logger.error(`Failed to register handler: ${Handler.name}`, { error });
      }
    }

    logger.info('Handler registration complete');
  } catch (error) {
    logger.error('Handler registration failed', { error });
    throw error;
  }
}
