"""Maps SourceType -> collector instance. The single place Phase 5's Celery task (and this phase's tests) resolve a collector from a Source row.""" from __future__ import annotations from app.collectors.base import SourceCollector from app.collectors.custom_url import CustomUrlCollector from app.collectors.github import GithubCollector from app.collectors.gov_contracts import GovContractCollector from app.collectors.jobs import JobPostingCollector from app.collectors.patents import PatentSourceCollector from app.collectors.reviews import ReviewSourceCollector from app.collectors.rss import RssCollector from app.collectors.sec_edgar import SecEdgarCollector from app.collectors.website import WebsiteCollector from app.models.enums import SourceType _COLLECTORS: dict[SourceType, SourceCollector] = { SourceType.WEBSITE: WebsiteCollector(), SourceType.RSS: RssCollector(), SourceType.CUSTOM_URL: CustomUrlCollector(), SourceType.SEC_EDGAR: SecEdgarCollector(), SourceType.GITHUB: GithubCollector(), SourceType.JOB_POSTING: JobPostingCollector(), SourceType.PATENT: PatentSourceCollector(), SourceType.REVIEW: ReviewSourceCollector(), SourceType.GOV_CONTRACT: GovContractCollector(), } def get_collector(source_type: SourceType) -> SourceCollector: return _COLLECTORS[source_type] def all_collectors() -> list[SourceCollector]: return list(_COLLECTORS.values())