"""FastAPI dependency injection configuration.""" from functools import lru_cache from src.domain.repositories import PlayerRepository, TeamRepository, FantasyRepository from src.infrastructure.adapters.nhl import NHLPlayerAdapter, NHLTeamAdapter from src.infrastructure.adapters.yahoo_fantasy import YahooFantasyAdapter from src.infrastructure.config import Settings, get_settings @lru_cache() def get_cached_settings() -> Settings: """Returns cached application settings.""" return get_settings() def get_player_repository() -> PlayerRepository: """ Provides the PlayerRepository implementation. This function can be modified to return different implementations without changing any business logic or API code. """ return NHLPlayerAdapter() def get_team_repository() -> TeamRepository: """ Provides the TeamRepository implementation. This function can be modified to return different implementations without changing any business logic or API code. """ return NHLTeamAdapter() def get_fantasy_repository() -> FantasyRepository: """ Provides the FantasyRepository implementation. This function can be modified to return different implementations without changing any business logic or API code. """ settings = get_cached_settings() return YahooFantasyAdapter( consumer_key=settings.yahoo_consumer_key, consumer_secret=settings.yahoo_consumer_secret, )