from __future__ import annotations

from packages.domain import IngestJob


class InMemoryIngestJobRepository:
    def __init__(self):
        self._items: dict[str, IngestJob] = {}

    def create(self, job: IngestJob) -> IngestJob:
        self._items[job.id] = job
        return job

    def get(self, job_id: str) -> IngestJob | None:
        return self._items.get(job_id)

    def update(self, job: IngestJob) -> IngestJob:
        self._items[job.id] = job
        return job
