//! # AT-Jet
//!
//! High-performance HTTP + Protobuf API framework for mobile services.

// Deny unwrap() and expect() in non-test code to prevent panics
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used))]
//! AT-Jet provides a clean, ergonomic way to build HTTP APIs that use Protocol Buffers
//! for serialization - ideal for mobile clients that need efficient bandwidth usage
//! and strong schema evolution guarantees.
//!
//! ## Features
//!
//! - **HTTP/1.1 and HTTP/2 support** via axum
//! - **Protobuf request/response handling** with automatic content negotiation
//! - **Dual-format support** - Protobuf for production, JSON for debugging
//! - **CDN-friendly** design for global mobile users
//! - **Middleware support** for authentication, logging, compression
//! - **Type-safe routing** with compile-time guarantees
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use at_jet::prelude::*;
//! use bytes::Bytes;
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//!     let app = JetServer::new()
//!         .route("/api/user/:id", get(get_user))
//!         .route("/api/user", post(create_user));
//!
//!     app.serve("0.0.0.0:8080").await?;
//!     Ok(())
//! }
//!
//! // Dual-format: accepts both protobuf and JSON, responds based on Accept header
//! async fn get_user(Path(id): Path<i32>) -> ProtobufResponse<User> {
//!     let user = User { id, name: "John".to_string() };
//!     ProtobufResponse::ok(user)
//! }
//!
//! async fn create_user(ApiRequest { body, format }: ApiRequest<CreateUserRequest>) -> ApiResponse<User> {
//!     // body is decoded from either protobuf or JSON based on Content-Type
//!     // response format matches the Accept header
//!     ApiResponse::ok(format, user)
//! }
//! ```

pub mod client;
pub mod dual_format;
pub mod error;
pub mod extractors;
pub mod middleware;
pub mod response;
pub mod server;

/// Re-exports for convenient usage
pub mod prelude {
  pub use crate::{client::JetClient,
                  dual_format::{AcceptFormat,
                                ApiRequest,
                                ApiResponse,
                                ApiResult,
                                DEBUG_FORMAT_HEADER,
                                ResponseFormat,
                                configure_debug_keys},
                  error::{JetError,
                          Result},
                  extractors::ProtobufRequest,
                  response::ProtobufResponse,
                  server::JetServer};

  // Re-export common axum types
  pub use axum::{Router,
                 extract::Path,
                 routing::{delete,
                           get,
                           patch,
                           post,
                           put}};

  // Re-export prost for protobuf
  pub use prost::Message;

  // Re-export serde for JSON support
  pub use serde::{Deserialize,
                  Serialize};

  // Re-export async_trait
  pub use async_trait::async_trait;

  // Re-export CORS types for server configuration
  pub use tower_http::cors::CorsLayer;
}

/// Content types used by AT-Jet
pub mod content_types {
  pub const APPLICATION_PROTOBUF: &str = "application/x-protobuf";
  pub const APPLICATION_JSON: &str = "application/json";
}
