from rights_filter.analysis.evidence_enrichment import EnrichmentSummary
from rights_filter.jobs.review_enrichment_job import ReviewEnrichmentJob


class RecordingEnricher:
    def __init__(self) -> None:
        self.calls: list[str] = []

    def enrich_latest(self, repository, submission_id: str) -> EnrichmentSummary:
        self.calls.append(submission_id)
        return EnrichmentSummary(generated_queries=1, executed_searches=1)


def test_review_enrichment_job_runs_for_each_submission():
    enricher = RecordingEnricher()
    job = ReviewEnrichmentJob(enricher)

    summary = job.run(repository=object(), submission_ids=["s1", "s2"])

    assert enricher.calls == ["s1", "s2"]
    assert summary.processed == 2
    assert summary.executed_searches == 2
