import { Module } from '@nestjs/common'; import { LoggingModule } from '../../domain/logging/LoggingModule'; import type { Logger } from '@core/shared/application/UseCaseOutputPort/UseCaseOutputPort/UseCaseOutputPort_TEMP_TEMP'; import type { DriverRepository } from '@core/racing/domain/repositories/DriverRepository'; import type { DriverStatsRepository } from '@core/racing/domain/repositories/DriverStatsRepository'; import type { GameRepository } from '@core/racing/domain/repositories/GameRepository'; import type { LeagueMembershipRepository } from '@core/racing/domain/repositories/LeagueMembershipRepository'; import type { LeagueRepository } from '@core/racing/domain/repositories/LeagueRepository'; import type { LeagueScoringConfigRepository } from '@core/racing/domain/repositories/LeagueScoringConfigRepository'; import type { LeagueWalletRepository } from '@core/racing/domain/repositories/LeagueWalletRepository'; import type { MediaRepository } from '@core/racing/domain/repositories/MediaRepository'; import type { PenaltyRepository } from '@core/racing/domain/repositories/PenaltyRepository'; import type { ProtestRepository } from '@core/racing/domain/repositories/ProtestRepository'; import type { RaceRegistrationRepository } from '@core/racing/domain/repositories/RaceRegistrationRepository'; import type { RaceRepository } from '@core/racing/domain/repositories/RaceRepository'; import type { ResultRepository } from '@core/racing/domain/repositories/ResultRepository'; import type { SeasonRepository } from '@core/racing/domain/repositories/SeasonRepository'; import type { SeasonSponsorshipRepository } from '@core/racing/domain/repositories/SeasonSponsorshipRepository'; import type { SponsorRepository } from '@core/racing/domain/repositories/SponsorRepository'; import type { SponsorshipPricingRepository } from '@core/racing/domain/repositories/SponsorshipPricingRepository'; import type { SponsorshipRequestRepository } from '@core/racing/domain/repositories/SponsorshipRequestRepository'; import type { StandingRepository } from '@core/racing/domain/repositories/StandingRepository'; import type { TeamMembershipRepository } from '@core/racing/domain/repositories/TeamMembershipRepository'; import type { TeamRepository } from '@core/racing/domain/repositories/TeamRepository'; import type { TeamStatsRepository } from '@core/racing/domain/repositories/TeamStatsRepository'; import type { TransactionRepository } from '@core/racing/domain/repositories/TransactionRepository'; import { getPointsSystems } from '@adapters/bootstrap/PointsSystems'; import { InMemoryDriverRepository } from '@adapters/racing/persistence/inmemory/InMemoryDriverRepository'; import { InMemoryDriverStatsRepository } from '@adapters/racing/persistence/inmemory/InMemoryDriverStatsRepository'; import { InMemoryGameRepository } from '@adapters/racing/persistence/inmemory/InMemoryGameRepository'; import { InMemoryLeagueMembershipRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueMembershipRepository'; import { InMemoryLeagueRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueRepository'; import { InMemoryLeagueScoringConfigRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueScoringConfigRepository'; import { InMemoryLeagueWalletRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueWalletRepository'; import { InMemoryPenaltyRepository } from '@adapters/racing/persistence/inmemory/InMemoryPenaltyRepository'; import { InMemoryProtestRepository } from '@adapters/racing/persistence/inmemory/InMemoryProtestRepository'; import { InMemoryRaceRegistrationRepository } from '@adapters/racing/persistence/inmemory/InMemoryRaceRegistrationRepository'; import { InMemoryRaceRepository } from '@adapters/racing/persistence/inmemory/InMemoryRaceRepository'; import { InMemoryResultRepository } from '@adapters/racing/persistence/inmemory/InMemoryResultRepository'; import { InMemorySeasonRepository } from '@adapters/racing/persistence/inmemory/InMemorySeasonRepository'; import { InMemorySeasonSponsorshipRepository } from '@adapters/racing/persistence/inmemory/InMemorySeasonSponsorshipRepository'; import { InMemorySponsorRepository } from '@adapters/racing/persistence/inmemory/InMemorySponsorRepository'; import { InMemorySponsorshipPricingRepository } from '@adapters/racing/persistence/inmemory/InMemorySponsorshipPricingRepository'; import { InMemorySponsorshipRequestRepository } from '@adapters/racing/persistence/inmemory/InMemorySponsorshipRequestRepository'; import { InMemoryStandingRepository } from '@adapters/racing/persistence/inmemory/InMemoryStandingRepository'; import { InMemoryTeamMembershipRepository } from '@adapters/racing/persistence/inmemory/InMemoryTeamMembershipRepository'; import { InMemoryTeamRepository } from '@adapters/racing/persistence/inmemory/InMemoryTeamRepository'; import { InMemoryTeamStatsRepository } from '@adapters/racing/persistence/inmemory/InMemoryTeamStatsRepository'; import { InMemoryTransactionRepository } from '@adapters/racing/persistence/inmemory/InMemoryTransactionRepository'; import { InMemoryMediaRepository } from '@adapters/racing/persistence/media/InMemoryMediaRepository'; export const DRIVER_REPOSITORY_TOKEN = 'IDriverRepository'; export const LEAGUE_REPOSITORY_TOKEN = 'ILeagueRepository'; export const RACE_REPOSITORY_TOKEN = 'IRaceRepository'; export const RESULT_REPOSITORY_TOKEN = 'IResultRepository'; export const STANDING_REPOSITORY_TOKEN = 'IStandingRepository'; export const LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN = 'ILeagueMembershipRepository'; export const RACE_REGISTRATION_REPOSITORY_TOKEN = 'IRaceRegistrationRepository'; export const TEAM_REPOSITORY_TOKEN = 'ITeamRepository'; export const TEAM_MEMBERSHIP_REPOSITORY_TOKEN = 'ITeamMembershipRepository'; export const PENALTY_REPOSITORY_TOKEN = 'IPenaltyRepository'; export const PROTEST_REPOSITORY_TOKEN = 'IProtestRepository'; export const SEASON_REPOSITORY_TOKEN = 'ISeasonRepository'; export const SEASON_SPONSORSHIP_REPOSITORY_TOKEN = 'ISeasonSponsorshipRepository'; export const LEAGUE_SCORING_CONFIG_REPOSITORY_TOKEN = 'ILeagueScoringConfigRepository'; export const GAME_REPOSITORY_TOKEN = 'IGameRepository'; export const LEAGUE_WALLET_REPOSITORY_TOKEN = 'ILeagueWalletRepository'; export const TRANSACTION_REPOSITORY_TOKEN = 'ITransactionRepository'; export const SPONSOR_REPOSITORY_TOKEN = 'ISponsorRepository'; export const SPONSORSHIP_PRICING_REPOSITORY_TOKEN = 'ISponsorshipPricingRepository'; export const SPONSORSHIP_REQUEST_REPOSITORY_TOKEN = 'ISponsorshipRequestRepository'; export const DRIVER_STATS_REPOSITORY_TOKEN = 'IDriverStatsRepository'; export const TEAM_STATS_REPOSITORY_TOKEN = 'ITeamStatsRepository'; export const MEDIA_REPOSITORY_TOKEN = 'IMediaRepository'; @Module({ imports: [LoggingModule], providers: [ { provide: DRIVER_REPOSITORY_TOKEN, useFactory: (logger: Logger): DriverRepository => new InMemoryDriverRepository(logger), inject: ['Logger'], }, { provide: LEAGUE_REPOSITORY_TOKEN, useFactory: (logger: Logger): LeagueRepository => new InMemoryLeagueRepository(logger), inject: ['Logger'], }, { provide: RACE_REPOSITORY_TOKEN, useFactory: (logger: Logger): RaceRepository => new InMemoryRaceRepository(logger), inject: ['Logger'], }, { provide: RESULT_REPOSITORY_TOKEN, useFactory: (logger: Logger, raceRepo: RaceRepository): ResultRepository => new InMemoryResultRepository(logger, raceRepo), inject: ['Logger', RACE_REPOSITORY_TOKEN], }, { provide: STANDING_REPOSITORY_TOKEN, useFactory: ( logger: Logger, resultRepo: ResultRepository, raceRepo: RaceRepository, leagueRepo: LeagueRepository, ): StandingRepository => new InMemoryStandingRepository(logger, getPointsSystems(), resultRepo, raceRepo, leagueRepo), inject: ['Logger', RESULT_REPOSITORY_TOKEN, RACE_REPOSITORY_TOKEN, LEAGUE_REPOSITORY_TOKEN], }, { provide: LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN, useFactory: (logger: Logger): LeagueMembershipRepository => new InMemoryLeagueMembershipRepository(logger), inject: ['Logger'], }, { provide: RACE_REGISTRATION_REPOSITORY_TOKEN, useFactory: (logger: Logger): RaceRegistrationRepository => new InMemoryRaceRegistrationRepository(logger), inject: ['Logger'], }, { provide: TEAM_REPOSITORY_TOKEN, useFactory: (logger: Logger): TeamRepository => new InMemoryTeamRepository(logger), inject: ['Logger'], }, { provide: TEAM_MEMBERSHIP_REPOSITORY_TOKEN, useFactory: (logger: Logger): TeamMembershipRepository => new InMemoryTeamMembershipRepository(logger), inject: ['Logger'], }, { provide: PENALTY_REPOSITORY_TOKEN, useFactory: (logger: Logger): PenaltyRepository => new InMemoryPenaltyRepository(logger), inject: ['Logger'], }, { provide: PROTEST_REPOSITORY_TOKEN, useFactory: (logger: Logger): ProtestRepository => new InMemoryProtestRepository(logger), inject: ['Logger'], }, { provide: SEASON_REPOSITORY_TOKEN, useFactory: (logger: Logger): SeasonRepository => new InMemorySeasonRepository(logger), inject: ['Logger'], }, { provide: SEASON_SPONSORSHIP_REPOSITORY_TOKEN, useFactory: (logger: Logger): SeasonSponsorshipRepository => new InMemorySeasonSponsorshipRepository(logger), inject: ['Logger'], }, { provide: LEAGUE_SCORING_CONFIG_REPOSITORY_TOKEN, useFactory: (logger: Logger): LeagueScoringConfigRepository => new InMemoryLeagueScoringConfigRepository(logger), inject: ['Logger'], }, { provide: GAME_REPOSITORY_TOKEN, useFactory: (logger: Logger): GameRepository => new InMemoryGameRepository(logger), inject: ['Logger'], }, { provide: LEAGUE_WALLET_REPOSITORY_TOKEN, useFactory: (logger: Logger): LeagueWalletRepository => new InMemoryLeagueWalletRepository(logger), inject: ['Logger'], }, { provide: TRANSACTION_REPOSITORY_TOKEN, useFactory: (logger: Logger): TransactionRepository => new InMemoryTransactionRepository(logger), inject: ['Logger'], }, { provide: SPONSOR_REPOSITORY_TOKEN, useFactory: (logger: Logger): SponsorRepository => new InMemorySponsorRepository(logger), inject: ['Logger'], }, { provide: SPONSORSHIP_PRICING_REPOSITORY_TOKEN, useFactory: (logger: Logger): SponsorshipPricingRepository => new InMemorySponsorshipPricingRepository(logger), inject: ['Logger'], }, { provide: SPONSORSHIP_REQUEST_REPOSITORY_TOKEN, useFactory: (logger: Logger): SponsorshipRequestRepository => new InMemorySponsorshipRequestRepository(logger), inject: ['Logger'], }, { provide: DRIVER_STATS_REPOSITORY_TOKEN, useFactory: (logger: Logger): DriverStatsRepository => new InMemoryDriverStatsRepository(logger), inject: ['Logger'], }, { provide: TEAM_STATS_REPOSITORY_TOKEN, useFactory: (logger: Logger): TeamStatsRepository => new InMemoryTeamStatsRepository(logger), inject: ['Logger'], }, { provide: MEDIA_REPOSITORY_TOKEN, useFactory: (logger: Logger): MediaRepository => new InMemoryMediaRepository(logger), inject: ['Logger'], }, ], exports: [ DRIVER_REPOSITORY_TOKEN, LEAGUE_REPOSITORY_TOKEN, RACE_REPOSITORY_TOKEN, RESULT_REPOSITORY_TOKEN, STANDING_REPOSITORY_TOKEN, LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN, RACE_REGISTRATION_REPOSITORY_TOKEN, TEAM_REPOSITORY_TOKEN, TEAM_MEMBERSHIP_REPOSITORY_TOKEN, PENALTY_REPOSITORY_TOKEN, PROTEST_REPOSITORY_TOKEN, SEASON_REPOSITORY_TOKEN, SEASON_SPONSORSHIP_REPOSITORY_TOKEN, LEAGUE_SCORING_CONFIG_REPOSITORY_TOKEN, GAME_REPOSITORY_TOKEN, LEAGUE_WALLET_REPOSITORY_TOKEN, TRANSACTION_REPOSITORY_TOKEN, SPONSOR_REPOSITORY_TOKEN, SPONSORSHIP_PRICING_REPOSITORY_TOKEN, SPONSORSHIP_REQUEST_REPOSITORY_TOKEN, DRIVER_STATS_REPOSITORY_TOKEN, TEAM_STATS_REPOSITORY_TOKEN, MEDIA_REPOSITORY_TOKEN, ], }) export class InMemoryRacingPersistenceModule {}