pub mod api;
pub mod dashboard;
pub mod openai;
pub mod streaming;
use axum::{routing::get, Json, Router};
use cortiq_engine::{CortiqRuntime, Pipeline};
use std::sync::Arc;
use tokio::sync::Mutex;
use tower_http::cors::CorsLayer;
pub struct AppState {
pub runtime: CortiqRuntime,
pub pipeline: Mutex<Pipeline>,
}
async fn healthz() -> Json<serde_json::Value> {
Json(serde_json::json!({ "status": "ok" }))
}
pub fn build_router(state: Arc<AppState>) -> Router {
Router::new()
.route("/healthz", get(healthz))
.merge(openai::routes())
.merge(api::routes())
.merge(dashboard::routes())
.layer(CorsLayer::permissive())
.with_state(state)
}