from __future__ import annotations

from typing import Protocol

from niannian.core.schemas.models import Atom
from niannian.storage.types import ArchiveResult, FlushResult, PullResult, SyncStatus


class MemoryStore(Protocol):
    """脑区 / Chat 统一存储接口。"""

    def read_atoms(
        self,
        project: str | None = None,
        *,
        limit: int = 500,
        status: str | None = None,
    ) -> list[Atom]: ...

    def append_atom(self, atom: Atom) -> None: ...

    def read_wiki_pages(self) -> dict: ...

    def update_wiki_pages(self, patch: dict) -> None: ...

    def read_wiki_pages_raw(self) -> dict: ...

    def write_wiki_pages_document(self, doc: dict) -> None: ...

    def read_wiki_graph_raw(self) -> dict: ...

    def write_wiki_graph(self, doc: dict) -> None: ...

    def read_wiki_compile_state(self) -> dict: ...

    def write_wiki_compile_state(self, doc: dict) -> None: ...

    def read_summaries(self) -> dict: ...

    def write_summaries(self, data: dict) -> None: ...

    def read_lifecycle(self) -> dict: ...

    def write_lifecycle(self, data: dict) -> None: ...

    def flush_to_cloud(self, *, force: bool = False) -> FlushResult: ...

    def pull_from_cloud(self) -> PullResult: ...

    def sync_status(self) -> SyncStatus: ...

    def archive_distilled(self, *, min_age_days: int = 7) -> ArchiveResult: ...
