from __future__ import annotations

from app.config import settings
from app.streaming.local_feed import local_feed
from app.streaming.metatrader_feed import metatrader_feed
from app.streaming.csv_feed import csv_feed
from app.streaming.historical_replay import historical_replay


# Registry for future providers. For now only the local simulator is available.
_PROVIDER_REGISTRY = {
    "historical_replay": historical_replay,
    "local_simulator": local_feed,
    "metatrader": metatrader_feed,
    "csv_replay": csv_feed,
}

provider_key = settings.DATA_PROVIDER.lower().strip()
data_provider = _PROVIDER_REGISTRY.get(provider_key)

if data_provider is None:
    raise ValueError(
        f"Unsupported DATA_PROVIDER '{settings.DATA_PROVIDER}'. Available: {', '.join(_PROVIDER_REGISTRY)}"
    )
