#![deny(missing_docs)]
#![deny(rust_2018_idioms)]
#![deny(rustdoc::broken_intra_doc_links)]

//! PostgreSQL + pgvector implementation of `klieo_core::memory::LongTermMemory`.
//!
//! Sibling to `klieo-memory-qdrant`: the same `LongTermMemory` +
//! `FilterableLongTermMemory` surface over an Aurora PostgreSQL Serverless v2
//! (or any Postgres with the `vector` extension) instead of Qdrant. Facts live
//! in one table with a `vector(dim)` column (HNSW, cosine) and `scope_kind` /
//! `scope_value` filter columns; metadata is stored as `jsonb` so relational
//! joins to domain keys (Versicherungsnummer, Vertrag, GeVo-Typ) remain
//! possible against the same table.
//!
//! `MemoryPgvector::connect(url)` is the capability-shaped default —
//! connects, lazily provisions the table on first `remember`, and returns an
//! `Arc<dyn LongTermMemory>`. Defaults to [`DummyEmbedder`].
//!
//! # Quickstart
//!
//! ```no_run
//! use klieo_memory_pgvector::MemoryPgvector;
//!
//! async fn example() {
//!     let mem = MemoryPgvector::connect("postgres://localhost/klieo").await.unwrap();
//!     let _ = mem.long_term;
//! }
//! ```
//!
//! # Advanced wiring — custom config + embedder
//!
//! ```no_run
//! use klieo_memory_pgvector::{MemoryPgvector, PgvectorConfig, DummyEmbedder};
//! use std::sync::Arc;
//!
//! async fn example() {
//!     let cfg = PgvectorConfig::new("postgres://aurora.internal/klieo?sslmode=require")
//!         .with_table_prefix("triage")
//!         .with_embedder_id("titan-v2");
//!     let mem = MemoryPgvector::new(cfg, Arc::new(DummyEmbedder)).await.unwrap();
//!     let _ = mem.long_term;
//! }
//! ```
//!
//! # What's implemented
//!
//! Only `LongTermMemory` (+ `FilterableLongTermMemory`). `ShortTermMemory` and
//! `EpisodicMemory` are not vector-shaped — see `klieo-memory-sqlite` /
//! `klieo-memory-neo4j`.

pub mod embedder;
pub use embedder::{DummyEmbedder, Embedder};

#[cfg(any(test, feature = "test-utils"))]
pub use embedder::FakeEmbedder;

pub mod client;
pub use client::PgvectorConfig;

pub mod error;

pub mod long_term;
pub use long_term::PgvectorLongTerm;

pub mod factory;
pub use factory::MemoryPgvector;
