from __future__ import annotations

from typing import Any, Protocol


class CaseEpicrisisContextProvider(Protocol):
    def get_case_context(self, username: str, case_key: str, *, regen: bool = False) -> dict[str, Any]: ...


class RipsPayloadRepository(Protocol):
    def ensure_indexes(self) -> None: ...

    def get_latest(self, username: str, case_key: str) -> dict[str, Any] | None: ...

    def save_version(
        self,
        *,
        username: str,
        case_key: str,
        payload: dict[str, Any],
        validation_report: dict[str, Any],
        field_trace_map: list[dict[str, Any]],
        source_context: dict[str, Any],
        regen_requested: bool,
    ) -> dict[str, Any]: ...

    def get_template(self, username: str, scope_candidates: list[dict[str, Any]]) -> dict[str, Any] | None: ...

    def save_template(
        self,
        *,
        username: str,
        scope: dict[str, Any],
        options: dict[str, Any],
    ) -> dict[str, Any]: ...
