use axum::{extract::Extension, http::StatusCode, Json};

use crate::{app_state::{AnalyticsBatchRequest, AppState}, error::AppError};

pub async fn batch(
    Extension(state): Extension<AppState>,
    Json(payload): Json<AnalyticsBatchRequest>,
) -> Result<StatusCode, AppError> {
    state.ingest_analytics_batch(payload).await?;
    Ok(StatusCode::ACCEPTED)
}
