use std::sync::Arc;
use axum::Router;
use axum::routing::{get, post};
use crate::handlers;
use crate::state::AppState;
use crate::websocket;
pub fn build_router(state: Arc<AppState>) -> Router {
Router::new()
.route("/v1/health", get(handlers::health))
.route("/v1/memories", post(handlers::store_memory))
.route(
"/v1/memories/{id}",
get(handlers::get_memory).delete(handlers::forget_memory),
)
.route("/v1/recall", post(handlers::recall_memories))
.route("/v1/search", post(handlers::search_similar))
.route("/v1/edges", post(handlers::create_edge))
.route("/v1/stats", get(handlers::stats))
.route("/v1/ingest", post(handlers::ingest_conversation))
.route("/v1/auth/token", post(crate::auth::generate_token))
.route(
"/v1/spaces",
post(handlers::create_space).get(handlers::list_spaces),
)
.route("/v1/spaces/{id}/grant", post(handlers::grant_space_access))
.route("/v1/ws/stream", get(websocket::ws_handler))
.route(
crate::cluster::GOSSIP_PATH,
post(crate::cluster::gossip_handler),
)
.route("/metrics", get(crate::metrics::handler))
.route("/console", get(crate::console::handler))
.route("/v1/admin/memories", get(handlers::admin_list_memories))
.route(
"/v1/admin/memories/{id}",
axum::routing::delete(handlers::admin_delete_memory),
)
.with_state(state)
}