from __future__ import annotations

from pathlib import Path
from typing import Any

from niannian.soul.subject_store import SubjectStateStore


class CognitiveStateStore:
    """P6 小吾 / P7 小情 — 委托 SubjectStateStore（向后兼容别名）。"""

    def __init__(self, home: Path) -> None:
        self._subject = SubjectStateStore(home)

    @property
    def _home(self) -> Path:
        return self._subject._home

    @property
    def subject_root(self) -> Path:
        return self._subject.subject_root

    def ensure_defaults(self) -> None:
        self._subject.ensure_defaults()

    def load_identity(self) -> dict[str, Any]:
        return self._subject.load_identity()

    def load_emotion(self) -> dict[str, Any]:
        return self._subject.load_emotion()

    def load_focus(self) -> dict[str, Any]:
        return self._subject.load_focus()

    def save_emotion(self, patch: dict[str, Any]) -> dict[str, Any]:
        return self._subject.save_emotion(patch)

    def load_subject_pack(self) -> dict[str, Any]:
        return self._subject.load_subject_pack()

    def health_summary(self) -> dict[str, Any]:
        return self._subject.health_summary()

    def load_open_threads(self) -> list[dict[str, Any]]:
        return self._subject.load_open_threads()

    def save_open_threads(self, threads: list[dict[str, Any]]) -> None:
        self._subject.save_open_threads(threads)
