// Public type contracts for the Governed Enterprise Memory Vault (Epic #204, Issue #205).
// Pure types and pure value-emitting frozen const tables only — no IO, no clock reads,
// no hashing, no randomness, no filesystem, no network. Leaf-package rule
// (ADR-0019 direction 1): no `@oscharko-dev/keiko-*` imports may appear in this module.
//
// The `MEMORY_SCHEMA_VERSION` discriminant follows the same evolution rule as
// `CONNECTED_CONTEXT_SCHEMA_VERSION` and `LOCAL_KNOWLEDGE_SCHEMA_VERSION`: a breaking
// change introduces a NEW literal member rather than mutating "1". Downstream packages
// (storage #206, capture #207, consolidation #208, retrieval #210, ...) pin against this
// literal so a schema break cannot silently propagate.
//
// Cross-cutting invariants (epic §Architecture Invariants):
//  1. Memory is scoped to a concrete coordinate (user / workspace / project / workflow /
//     global). There is no implicit cross-scope visibility — a record at scope kind X is
//     never visible at scope kind Y unless an explicit operation moves it.
//  2. Every durable memory carries provenance and a sensitivity class. The capture and
//     audit layers MUST honour the sensitivity contract; this module pins the type so
//     the obligation is non-bypassable at the type level.
//  3. The status lifecycle is a directed graph; illegal transitions are rejected by the
//     pure validator in memory-validation.ts. The transition matrix lives here so every
//     reader and writer pins against the same source of truth.
// ─── Schema version ───────────────────────────────────────────────────────────
export const MEMORY_SCHEMA_VERSION = "1";
export const MEMORY_SCOPE_KINDS = [
    "user",
    "workspace",
    "project",
    "workflow",
    "global",
];
export const MEMORY_TYPES = [
    "episodic",
    "semantic-fact",
    "procedural",
    "preference",
    "correction",
    "decision",
    "negative",
    "pinned",
];
export const MEMORY_SENSITIVITIES = [
    "public",
    "confidential",
    "restricted",
];
export const MEMORY_STATUSES = [
    "proposed",
    "accepted",
    "rejected",
    "superseded",
    "archived",
    "forgotten",
    "conflicted",
    "expired",
];
// Allowed transitions. Read as: from-state → set of legal next-states.
//
// Design notes (encoded so future readers do not have to reverse-engineer):
//  - "rejected" and "forgotten" are absorbing for normal operation (no outbound edges).
//    "forgotten" is the destructive-delete terminus required by #209.
//  - "superseded" can become "archived" (e.g. when its replacement is itself archived
//    in a batch cleanup) but cannot return to "accepted" — supersession is monotonic.
//  - "conflicted" and "expired" can be rehabilitated back to "accepted" once the
//    conflict-resolution job (#209) or a re-validation pass clears the condition.
//  - "archived" can be restored to "accepted" — archival is non-destructive.
//  - A "proposed" memory can also reach "expired" if its capture window elapses before
//    review (proposal TTL is enforced by #207, not by this contract).
export const MEMORY_STATUS_TRANSITIONS = {
    proposed: ["accepted", "rejected", "expired"],
    accepted: ["superseded", "archived", "forgotten", "conflicted", "expired"],
    rejected: [],
    superseded: ["archived", "forgotten"],
    archived: ["accepted", "forgotten"],
    forgotten: [],
    conflicted: ["accepted", "superseded", "archived", "forgotten"],
    expired: ["accepted", "archived", "forgotten"],
};
export const MEMORY_SOURCE_KINDS = [
    "explicit-user-instruction",
    "accepted-correction",
    "workflow-outcome",
    "consolidation",
    "system-default",
];
export const MEMORY_EDGE_KINDS = [
    "related",
    "derived-from",
    "supersedes",
    "corrects",
    "conflicts-with",
    "temporal-precedes",
];
export const MEMORY_AUDIT_ACTION_KINDS = [
    "proposed",
    "accepted",
    "rejected",
    "updated",
    "superseded",
    "pinned",
    "unpinned",
    "archived",
    "forgotten",
    "retrieved",
];
