from app.data_sources.base import PortfolioDataProvider
from app.data_sources.ghostfolio_api_provider import GhostfolioAPIDataProvider
from app.data_sources.mock_file_provider import MockFileDataProvider
from app.data_sources.mock_provider import MockPortfolioDataProvider
from app.schemas import DATA_SOURCE_MOCK, DATA_SOURCE_MOCK_FILE, DataSource


def build_provider(data_source: DataSource, api_provider: GhostfolioAPIDataProvider) -> PortfolioDataProvider:
    if data_source == DATA_SOURCE_MOCK:
        return MockPortfolioDataProvider()
    if data_source == DATA_SOURCE_MOCK_FILE:
        return MockFileDataProvider()
    return api_provider
