import { ContainerModule } from 'inversify';
import { RaceService } from '@/lib/services/races/RaceService';
import { RaceResultsService } from '@/lib/services/races/RaceResultsService';
import { RaceStewardingService } from '@/lib/services/races/RaceStewardingService';

import {
  RACE_SERVICE_TOKEN,
  RACE_RESULTS_SERVICE_TOKEN,
  RACE_STEWARDING_SERVICE_TOKEN,
} from '../tokens';

export const RaceModule = new ContainerModule((options) => {
  const bind = options.bind;

  // Race Service - creates its own dependencies per contract
  bind<RaceService>(RACE_SERVICE_TOKEN)
    .to(RaceService)
    .inSingletonScope();

  // Race Results Service - creates its own dependencies per contract
  bind<RaceResultsService>(RACE_RESULTS_SERVICE_TOKEN)
    .to(RaceResultsService)
    .inSingletonScope();

  // Race Stewarding Service - creates its own dependencies per contract
  bind<RaceStewardingService>(RACE_STEWARDING_SERVICE_TOKEN)
    .to(RaceStewardingService)
    .inSingletonScope();
});