use axum::Json;
use serde_json::{Value, json};

use crate::auth::AuthenticatedUser;
use crate::error::AppError;

pub async fn handle_whoami(user: AuthenticatedUser) -> Result<Json<Value>, AppError> {
    Ok(Json(json!({
        "slug": user.slug,
        "role": user.role,
        "data_dir": user.data_dir.to_string_lossy(),
    })))
}
