//! anycms-core
//!
//! A unified API response library supporting multiple Rust web frameworks.
//!
//! ## Features
//! - `actix` (default): Support for actix-web framework
//! - `axum`: Support for axum framework
//! - `validator`: Integration with the `validator` crate for derive-based validation
//! - `tracing`: Automatic error logging via the `tracing` crate
//! - `full`: Enable all framework integrations
//! - `camel-case` (default): Use camelCase for JSON field names
//! - `snake-case`: Use snake_case for JSON field names
//!
//! ## Basic Usage
//! ```rust
//! use anycms_core::ApiResult;
//! use serde::Serialize;
//!
//! #[derive(Serialize)]
//! struct User {
//!     id: u32,
//!     name: String,
//! }
//!
//! fn handle_request() -> ApiResult<User> {
//!     let user = User { id: 1, name: "Alice".to_string() };
//!     ApiResult::value(user)
//! }
//! ```
//!
//! ## Business Error Code & Timestamp
//! ```rust
//! use anycms_core::ApiResult;
//! use serde::Serialize;
//!
//! #[derive(Serialize)]
//! struct User {
//!     id: u32,
//!     name: String,
//! }
//!
//! fn handle_error() -> ApiResult<User> {
//!     ApiResult::fail("User not found")
//!         .with_code(404)
//!         .with_biz_code(10001)
//!         .with_current_timestamp()
//! }
//!
//! fn handle_success() -> ApiResult<()> {
//!     ApiResult::ok()
//!         .with_message("Done")
//!         .with_biz_code(0)
//!         .with_timestamp(1700000000000)
//! }
//! ```
//!
//! ## Error Handling
//! ```rust
//! use anycms_core::ApiResult;
//!
//! fn handle_error() -> ApiResult<String> {
//!     ApiResult::fail("Resource not found").with_code(404)
//! }
//! ```
//!
//! ## Validation Errors
//! ```rust
//! use anycms_core::{ApiResult, FieldError};
//!
//! fn validate() -> ApiResult<String> {
//!     ApiResult::validation_errors(vec![
//!         FieldError::new("email", "invalid format"),
//!     ])
//! }
//! ```
//!
//! ## Request Tracing
//! ```rust
//! use anycms_core::ApiResult;
//!
//! fn handler() -> ApiResult<String> {
//!     ApiResult::ok().with_trace_id("req-abc123")
//! }
//! ```

mod pagination;
mod result;

// Framework-specific implementations
mod frameworks;

// Optional integrations
#[cfg(feature = "validator")]
mod validator;

#[cfg(feature = "tracing")]
mod tracing;

// Core exports (always available)
pub use pagination::ResultPagination;
pub use result::{ApiResult, DefaultResult, ErrorCode, FieldError, ResponseData};

// Framework-specific exports (available only when corresponding feature is enabled)
#[cfg(feature = "actix")]
pub use frameworks::actix;

#[cfg(feature = "axum")]
pub use frameworks::axum;

// Optional integration exports
#[cfg(feature = "validator")]
pub use validator::validation_errors_to_field_errors;

#[cfg(feature = "tracing")]
pub use tracing::ApiResultTracing;
