"""Multi-source document fetcher registry."""

from .base import SourceDocument, SourceFetcher
from .etsi import ETSIFetcher
from .ietf import IETFFetcher
from .iso import ISOFetcher
from .itu import ITUFetcher
from .nist import NISTFetcher
from .w3c import W3CFetcher

FETCHERS = {
    "ietf": IETFFetcher,
    "w3c": W3CFetcher,
    "etsi": ETSIFetcher,
    "itu": ITUFetcher,
    "iso": ISOFetcher,
    "nist": NISTFetcher,
}


def get_fetcher(source_name: str, config=None):
    cls = FETCHERS.get(source_name)
    if cls is None:
        raise ValueError(f"Unknown source: {source_name}")
    return cls(config)
