mod response;
mod identity;

use axum::{routing::get, Json, Router};
use response::SigmaInformation;
use tracing::instrument;

#[allow(unused)]
use log::{info, debug, warn, error, trace};

const NAME: &str = "TinySigma";
const VERSION: &str = "0.0.2.1";

pub fn router() -> Router {
    info!("Loading {NAME} app routes");
    debug!("TinySigma version is {}", VERSION);
    Router::new()
        .route("/", get(information))
        .nest("/identity", identity::router())
}

#[instrument]
async fn information() -> Json<SigmaInformation> {
    Json(SigmaInformation::new(NAME, VERSION))
}