from __future__ import annotations

from dataclasses import asdict, dataclass, field
from typing import Any


@dataclass
class RecordResult:
    atom_id: str
    thread_id: str | None = None
    wiki_touched: list[str] = field(default_factory=list)
    deduped: bool = False
    atom: dict[str, Any] | None = None

    def to_dict(self) -> dict[str, Any]:
        return asdict(self)


@dataclass
class RecallPack:
    pack_id: str
    policy: str
    context_block: str
    layers: dict[str, Any] = field(default_factory=dict)
    citations: list[dict[str, Any]] = field(default_factory=list)
    skill_snippets: list[str] = field(default_factory=list)
    recall_trace: list[str] = field(default_factory=list)
    suggested_record: dict[str, Any] | None = None

    def to_dict(self) -> dict[str, Any]:
        return asdict(self)


@dataclass
class ReflectResult:
    threads_merged: int = 0
    summaries_written: int = 0
    atoms_touched: int = 0
    trace: list[str] = field(default_factory=list)

    def to_dict(self) -> dict[str, Any]:
        return asdict(self)
