import { Module, forwardRef } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';

import { BookingsModule } from '../bookings/bookings.module';
import { Container } from '../container-management/entities/container.entity';
import { LocomotivesModule } from '../locomotives/locomotives.module';
import { RuleEngineModule } from '../rule-engine/rule-engine.module';
import { Locomotive } from '../locomotives/entities/locomotive.entity';
import { Route } from '../routes/entities/route.entity';
import { TrainSetWagon } from '../train-sets/entities/train-set-wagon.entity';
import { TrainSet } from '../train-sets/entities/train-set.entity';
import { TrainSetsModule } from '../train-sets/train-sets.module';
import { TrainSchedulesModule } from '../train-schedules/train-schedules.module';
import { WagonType } from '../wagon-types/entities/wagon-type.entity';
import { WagonTypesModule } from '../wagon-types/wagon-types.module';
import { Wagon } from '../wagons/entities/wagon.entity';
import { TrainCheckpointEvent } from './entities/train-checkpoint-event.entity';
import { TrainSchedulingGlobalRules } from './entities/train-scheduling-global-rules.entity';
import { TrainCheckpointEventsRepository } from './train-checkpoint-events.repository';
import { TrainSchedulingController } from './train-scheduling.controller';
import { TrainSchedulingService } from './train-scheduling.service';
import { BookingBatchService } from './booking-batch.service';
import { BookingNotifierService } from './booking-notifier.service';
import { NotificationsModule } from '../notifications/notifications.module';

@Module({
  imports: [
    TypeOrmModule.forFeature([
      Locomotive,
      WagonType,
      TrainSet,
      TrainSetWagon,
      Route,
      Wagon,
      Container,
      TrainSchedulingGlobalRules,
      TrainCheckpointEvent,
    ]),
    forwardRef(() => BookingsModule),
    NotificationsModule,
    LocomotivesModule,
    WagonTypesModule,
    TrainSetsModule,
    TrainSchedulesModule,
    RuleEngineModule,
  ],
  controllers: [TrainSchedulingController],
  providers: [
    TrainSchedulingService,
    TrainCheckpointEventsRepository,
    BookingBatchService,
    BookingNotifierService,
  ],
  exports: [TrainSchedulingService, BookingBatchService],
})
export class TrainSchedulingModule {}
