//! Knowledge lifecycle management for pattern deprecation and migration.
//!
//! Implements the knowledge lifecycle state machine:
//!
//! ```text
//!     Active ────────────────────────┐
//!        │                           │
//!        ├── deprecate ──────┐       │
//!        │                   ▼       │
//!        │               Deprecated  │
//!        │                   │       │
//!        │     ┌─────────────┤       │
//!        │     │             │       │
//!        │  reactivate   archive     │
//!        │     │             │       │
//!        │     ▼             ▼       │
//!        └─────┬─────────► Archived  │
//!              │             │       │
//!              │        (terminal)   │
//!              │                     │
//!              └─ superseded ────────┘
//!                               │
//!                               ▼
//!                          Superseded
//!                          (terminal)
//! ```
//!
//! # Features
//!
//! - **Deprecation**: Mark patterns as deprecated with reason, superseded_by, sunset date
//! - **Migration tracking**: Track usage of deprecated patterns across projects
//! - **Audit trail**: Full history of status transitions with timestamp and initiator
//! - **Soft removal**: Deprecated patterns FLAG (not BLOCK) to allow gradual migration

mod migration;
mod store;
mod types;

pub use migration::{DeprecatedUsage, MigrationProgress, MigrationStore};
pub use store::LifecycleStore;
pub use types::{KnowledgeLifecycle, KnowledgeStatus, StatusTransition};

use std::path::PathBuf;

/// Get the default lifecycle store directory.
pub fn lifecycle_store_dir() -> PathBuf {
    if let Some(home) = dirs::home_dir() {
        home.join(".aphoria").join("lifecycle")
    } else {
        PathBuf::from(".aphoria/lifecycle")
    }
}
