/** * Infrastructure Adapter: InMemoryMediaRepository * * In-memory implementation of IMediaRepository. * Stores URLs for static media assets like logos and images. */ import type { IMediaRepository } from '@core/racing/domain/repositories/IMediaRepository'; import type { Logger } from '@core/shared/application'; export class InMemoryMediaRepository implements IMediaRepository { private driverAvatars = new Map(); private teamLogos = new Map(); private trackImages = new Map(); private categoryIcons = new Map(); private sponsorLogos = new Map(); constructor(private readonly logger: Logger) { this.logger.info('[InMemoryMediaRepository] Initialized.'); } async getDriverAvatar(driverId: string): Promise { return this.driverAvatars.get(driverId) ?? null; } async getTeamLogo(teamId: string): Promise { return this.teamLogos.get(teamId) ?? null; } async getTrackImage(trackId: string): Promise { return this.trackImages.get(trackId) ?? null; } async getCategoryIcon(categoryId: string): Promise { return this.categoryIcons.get(categoryId) ?? null; } async getSponsorLogo(sponsorId: string): Promise { return this.sponsorLogos.get(sponsorId) ?? null; } // Helper methods for seeding setDriverAvatar(driverId: string, url: string): void { this.driverAvatars.set(driverId, url); } setTeamLogo(teamId: string, url: string): void { this.teamLogos.set(teamId, url); } setTrackImage(trackId: string, url: string): void { this.trackImages.set(trackId, url); } setCategoryIcon(categoryId: string, url: string): void { this.categoryIcons.set(categoryId, url); } setSponsorLogo(sponsorId: string, url: string): void { this.sponsorLogos.set(sponsorId, url); } async clear(): Promise { this.driverAvatars.clear(); this.teamLogos.clear(); this.trackImages.clear(); this.categoryIcons.clear(); this.sponsorLogos.clear(); } }