"""Source registry for mykb."""

from .base import BaseSource, SourceItem
from .obsidian import ObsidianSource

__all__ = ['BaseSource', 'SourceItem', 'get_source']

SOURCE_REGISTRY: dict[str, type[BaseSource]] = {
    'obsidian': ObsidianSource,
}


def get_source(source_type: str, collection_name: str, config: dict) -> BaseSource:
    cls = SOURCE_REGISTRY.get(source_type)
    if not cls:
        raise ValueError(f'Unknown source type: {source_type}')
    return cls(collection_name, config)
