pub mod audit;
#[cfg(feature = "cluster")]
pub mod cluster;
#[cfg(feature = "cluster")]
pub(crate) mod cluster_utils;
#[cfg(feature = "cluster")]
pub mod raft_rpc;
#[cfg(feature = "dag")]
pub mod dag;
mod memory;
mod observability;
#[cfg(feature = "p2p")]
mod p2p;
mod proof;
mod proof_api;
mod query;
mod reputation;
mod skill_verification;
mod stats;
mod triples;
pub use proof::{
ProofDto, ProofStepDto, StatementInput, ValidateRequest, ValidateResponse, ValidateTripleInput,
ValidationMessage, VerificationDetails, VerifyProofRequest,
};
pub use proof_api::{
BatchSubmitRequest, BatchSubmitResponse, BatchVerifyRequest, BatchVerifyResponse,
DeleteProofResponse, ListProofsQuery, ListProofsResponse, ProofResponse, ProofStatsResponse,
SubmitProofResponse,
};
pub use query::*;
pub use stats::*;
pub use triples::*;
use crate::state::AppState;
use axum::{
routing::{delete, get, post},
Router,
};
pub fn router() -> Router<AppState> {
let router = Router::new()
.route("/api/v1/triples", post(triples::create_triple))
.route("/api/v1/triples", get(triples::list_triples))
.route(
"/api/v1/triples/batch",
post(triples::batch_insert_triples),
)
.route("/api/v1/triples/{id}", get(triples::get_triple))
.route("/api/v1/triples/{id}", delete(triples::delete_triple))
.route("/api/v1/query", post(query::query_pattern))
.route("/api/v1/query/subjects", get(query::list_subjects))
.route("/api/v1/query/predicates", get(query::list_predicates))
.route("/api/v1/stats", get(stats::get_stats))
.route("/api/v1/health", get(stats::health_check))
.route("/api/v1/flush", post(stats::flush_data))
.route("/api/v1/validate", post(proof::validate_triples))
.route("/api/v1/proof/{hash}", get(proof::get_proof))
.route("/api/v1/verify", post(proof::verify_proof))
.route("/api/v1/proofs", post(proof_api::submit_proof))
.route("/api/v1/proofs", get(proof_api::list_proofs))
.route("/api/v1/proofs/batch", post(proof_api::submit_proofs_batch))
.route("/api/v1/proofs/stats", get(proof_api::get_proof_stats))
.route(
"/api/v1/proofs/verify/batch",
post(proof_api::verify_proofs_batch),
)
.route("/api/v1/proofs/{id}", get(proof_api::get_proof))
.route("/api/v1/proofs/{id}", delete(proof_api::delete_proof))
.route(
"/api/v1/proofs/{id}/verify",
get(proof_api::verify_proof_by_id),
)
.merge(memory::memory_router())
.merge(observability::observability_router())
.merge(skill_verification::skill_verification_router())
.merge(reputation::reputation_router())
.merge(audit::audit_router());
#[cfg(feature = "p2p")]
let router = router.merge(p2p::p2p_router());
#[cfg(feature = "cluster")]
let router = router
.merge(cluster::cluster_router())
.merge(raft_rpc::raft_rpc_router());
#[cfg(feature = "dag")]
let router = router.merge(dag::dag_router());
router
}