"""Atom belief_status 校验。"""

from __future__ import annotations

BELIEF_STATUSES = frozenset({"active", "superseded", "retracted", "hypothesis"})


class InvalidBeliefStatusError(ValueError):
    pass


def normalize_belief_status(value: object, *, default: str = "active") -> str:
    raw = str(value or default).strip().lower()
    if raw not in BELIEF_STATUSES:
        raise InvalidBeliefStatusError(f"invalid belief_status: {value!r}")
    return raw
