use axum::Router;
use r2d2::Pool;
use r2d2_sqlite::SqliteConnectionManager;

use crate::chat::routes::chat_routes;
use crate::inventory::routes::inventory_routes;
use crate::rooms::routes::rooms_routes;
use crate::utils::routes::utils_routes;
use crate::utils::db_pool::AppState;

pub fn create_router(state: AppState) -> Router {
    Router::new()
        .nest("/auth", utils_routes().with_state(state.clone()))
        .nest("/rooms", rooms_routes().with_state(state.clone()))
        .nest("/chat", chat_routes().with_state(state.clone()))
        .nest("/inventory", inventory_routes().with_state(state.clone()))
        .with_state(state)
}
