import { Provider } from '@nestjs/common'; // Import core interfaces import type { Logger } from '@core/shared/application/Logger'; import { IDriverRepository } from '@core/racing/domain/repositories/IDriverRepository'; import { IRaceRepository } from '@core/racing/domain/repositories/IRaceRepository'; import { IResultRepository } from '@core/racing/domain/repositories/IResultRepository'; import { ILeagueRepository } from '@core/racing/domain/repositories/ILeagueRepository'; import { IStandingRepository } from '@core/racing/domain/repositories/IStandingRepository'; import { ILeagueMembershipRepository } from '@core/racing/domain/repositories/ILeagueMembershipRepository'; import { IRaceRegistrationRepository } from '@core/racing/domain/repositories/IRaceRegistrationRepository'; import { IFeedRepository } from '@core/social/domain/repositories/IFeedRepository'; import { ISocialGraphRepository } from '@core/social/domain/repositories/ISocialGraphRepository'; import { ImageServicePort } from '@core/media/application/ports/ImageServicePort'; import { DashboardOverviewUseCase } from '@core/racing/application/use-cases/DashboardOverviewUseCase'; // Import concrete implementations import { ConsoleLogger } from '@adapters/logging/ConsoleLogger'; import { InMemoryDriverRepository } from '@adapters/racing/persistence/inmemory/InMemoryDriverRepository'; import { InMemoryRaceRepository } from '@adapters/racing/persistence/inmemory/InMemoryRaceRepository'; import { InMemoryResultRepository } from '@adapters/racing/persistence/inmemory/InMemoryResultRepository'; import { InMemoryLeagueRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueRepository'; import { InMemoryStandingRepository } from '@adapters/racing/persistence/inmemory/InMemoryStandingRepository'; import { InMemoryLeagueMembershipRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueMembershipRepository'; import { InMemoryRaceRegistrationRepository } from '@adapters/racing/persistence/inmemory/InMemoryRaceRegistrationRepository'; import { InMemoryImageServiceAdapter } from '@adapters/media/ports/InMemoryImageServiceAdapter'; import { DashboardOverviewPresenter } from './presenters/DashboardOverviewPresenter'; // Simple mock implementations for missing adapters class MockFeedRepository implements IFeedRepository { // eslint-disable-next-line @typescript-eslint/no-unused-vars async getFeedForDriver(_driverId: string, _limit?: number) { return []; } // eslint-disable-next-line @typescript-eslint/no-unused-vars async getGlobalFeed(_limit?: number) { return []; } } class MockSocialGraphRepository implements ISocialGraphRepository { // eslint-disable-next-line @typescript-eslint/no-unused-vars async getFriends(_driverId: string) { return []; } // eslint-disable-next-line @typescript-eslint/no-unused-vars async getFriendIds(_driverId: string) { return []; } // eslint-disable-next-line @typescript-eslint/no-unused-vars async getSuggestedFriends(_driverId: string, _limit?: number) { return []; } } // Define injection tokens export const LOGGER_TOKEN = 'Logger'; export const DRIVER_REPOSITORY_TOKEN = 'IDriverRepository'; export const RACE_REPOSITORY_TOKEN = 'IRaceRepository'; export const RESULT_REPOSITORY_TOKEN = 'IResultRepository'; export const LEAGUE_REPOSITORY_TOKEN = 'ILeagueRepository'; export const STANDING_REPOSITORY_TOKEN = 'IStandingRepository'; export const LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN = 'ILeagueMembershipRepository'; export const RACE_REGISTRATION_REPOSITORY_TOKEN = 'IRaceRegistrationRepository'; export const FEED_REPOSITORY_TOKEN = 'IFeedRepository'; export const SOCIAL_GRAPH_REPOSITORY_TOKEN = 'ISocialGraphRepository'; export const IMAGE_SERVICE_TOKEN = 'IImageServicePort'; export const DASHBOARD_OVERVIEW_USE_CASE_TOKEN = 'DashboardOverviewUseCase'; export const DASHBOARD_OVERVIEW_OUTPUT_PORT_TOKEN = 'DashboardOverviewOutputPort'; export const DashboardProviders: Provider[] = [ DashboardOverviewPresenter, { provide: LOGGER_TOKEN, useClass: ConsoleLogger, }, { provide: DRIVER_REPOSITORY_TOKEN, useFactory: (logger: Logger) => new InMemoryDriverRepository(logger), inject: [LOGGER_TOKEN], }, { provide: RACE_REPOSITORY_TOKEN, useFactory: (logger: Logger) => new InMemoryRaceRepository(logger), inject: [LOGGER_TOKEN], }, { provide: RESULT_REPOSITORY_TOKEN, useFactory: (logger: Logger) => new InMemoryResultRepository(logger), inject: [LOGGER_TOKEN], }, { provide: LEAGUE_REPOSITORY_TOKEN, useFactory: (logger: Logger) => new InMemoryLeagueRepository(logger), inject: [LOGGER_TOKEN], }, { provide: STANDING_REPOSITORY_TOKEN, useFactory: (logger: Logger) => new InMemoryStandingRepository(logger, {}), inject: [LOGGER_TOKEN], }, { provide: LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN, useFactory: (logger: Logger) => new InMemoryLeagueMembershipRepository(logger), inject: [LOGGER_TOKEN], }, { provide: RACE_REGISTRATION_REPOSITORY_TOKEN, useFactory: (logger: Logger) => new InMemoryRaceRegistrationRepository(logger), inject: [LOGGER_TOKEN], }, { provide: FEED_REPOSITORY_TOKEN, useFactory: () => new MockFeedRepository(), }, { provide: SOCIAL_GRAPH_REPOSITORY_TOKEN, useFactory: () => new MockSocialGraphRepository(), }, { provide: IMAGE_SERVICE_TOKEN, useFactory: (logger: Logger) => new InMemoryImageServiceAdapter(logger), inject: [LOGGER_TOKEN], }, { provide: DASHBOARD_OVERVIEW_OUTPUT_PORT_TOKEN, useExisting: DashboardOverviewPresenter, }, { provide: DASHBOARD_OVERVIEW_USE_CASE_TOKEN, useFactory: ( driverRepo: IDriverRepository, raceRepo: IRaceRepository, resultRepo: IResultRepository, leagueRepo: ILeagueRepository, standingRepo: IStandingRepository, membershipRepo: ILeagueMembershipRepository, registrationRepo: IRaceRegistrationRepository, feedRepo: IFeedRepository, socialRepo: ISocialGraphRepository, imageService: ImageServicePort, output: DashboardOverviewPresenter, ) => new DashboardOverviewUseCase( driverRepo, raceRepo, resultRepo, leagueRepo, standingRepo, membershipRepo, registrationRepo, feedRepo, socialRepo, async (driverId: string) => imageService.getDriverAvatar(driverId), () => null, output, ), inject: [ DRIVER_REPOSITORY_TOKEN, RACE_REPOSITORY_TOKEN, RESULT_REPOSITORY_TOKEN, LEAGUE_REPOSITORY_TOKEN, STANDING_REPOSITORY_TOKEN, LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN, RACE_REGISTRATION_REPOSITORY_TOKEN, FEED_REPOSITORY_TOKEN, SOCIAL_GRAPH_REPOSITORY_TOKEN, IMAGE_SERVICE_TOKEN, DASHBOARD_OVERVIEW_OUTPUT_PORT_TOKEN, ], }, ];