use crate::api::middleware::AuthedUser;
use crate::api::state::AppState;
use axum::extract::Extension;
use axum::Json;
use serde_json::{json, Value};
use std::sync::Arc;

/// `POST /api/ab/settings` — capability/limit probe. The Flutter client
/// (ab_model.dart:230-258) calls this once per pull cycle to learn
/// `max_peer_one_ab`. Auth is required even though there is no body.
pub async fn settings(
    Extension(state): Extension<Arc<AppState>>,
    _user: AuthedUser,
) -> Json<Value> {
    Json(json!({ "max_peer_one_ab": state.cfg.ab_max_peers_per_book }))
}
