"""The factory picks WarehouseSource vs RawFileSource from settings (combined_book_data_source)."""
from __future__ import annotations

from fxhnt.application.combined_book_factory import make_combined_book_source
from fxhnt.application.combined_book_source import RawFileSource, WarehouseSource
from fxhnt.config import Settings


def test_factory_raw_default(tmp_path) -> None:
    s = Settings(combined_book_data_source="raw", warehouse_path=str(tmp_path / "wh.duckdb"))
    assert isinstance(make_combined_book_source(s, "/data/surfer"), RawFileSource)


def test_factory_warehouse(tmp_path) -> None:
    s = Settings(combined_book_data_source="warehouse", warehouse_path=str(tmp_path / "wh.duckdb"))
    assert isinstance(make_combined_book_source(s, "/data/surfer"), WarehouseSource)
