//! Unified database facade for `LaminarDB`.
//!
//! Provides a single entry point (`LaminarDB`) that ties together
//! the SQL parser, query planner, `DataFusion` context, and streaming API.
//!
//! # Example
//!
//! ```rust,ignore
//! use laminar_db::LaminarDB;
//!
//! let db = LaminarDB::open()?;
//!
//! db.execute("CREATE SOURCE trades (
//!     symbol VARCHAR, price DOUBLE, ts BIGINT,
//!     WATERMARK FOR ts AS ts - INTERVAL '1' SECOND
//! )").await?;
//!
//! let query = db.execute("SELECT symbol, AVG(price)
//!     FROM trades GROUP BY symbol, TUMBLE(ts, INTERVAL '1' MINUTE)
//! ").await?;
//! ```

#![deny(missing_docs)]
#![warn(clippy::all, clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::disallowed_types)]

#[allow(dead_code)]
mod adaptive;
mod aggregate_state;
mod asof_batch;
mod batch_filter;
mod builder;
mod catalog;
/// Unified checkpoint coordination.
pub mod checkpoint_coordinator;
mod config;
mod connector_manager;
mod core_window_state;
mod db;
mod eowc_state;
mod error;
mod handle;
mod metrics;
/// Event-driven connector pipeline (fan-out/fan-in architecture).
pub mod pipeline;
mod pipeline_checkpoint;
/// Deployment profiles.
pub mod profile;
/// Unified recovery manager.
pub mod recovery_manager;
mod sink_task;
mod sql_utils;
mod stream_executor;
mod table_backend;
mod table_cache_mode;
mod table_provider;
mod table_store;
mod temporal_batch;

/// FFI-friendly API for language bindings.
///
/// Enable with the `api` feature flag:
/// ```toml
/// laminar-db = { version = "0.1", features = ["api"] }
/// ```
///
/// This module provides thread-safe types with numeric error codes,
/// explicit resource management, and Arrow RecordBatch at all boundaries.
#[cfg(feature = "api")]
pub mod api;

/// C FFI layer for LaminarDB.
///
/// Enable with the `ffi` feature flag:
/// ```toml
/// laminar-db = { version = "0.1", features = ["ffi"] }
/// ```
///
/// This module provides `extern "C"` functions for calling LaminarDB from C
/// and any language with C FFI support (Python, Java, Node.js, .NET, etc.).
#[cfg(feature = "ffi")]
pub mod ffi;

pub use builder::LaminarDbBuilder;
pub use catalog::{SourceCatalog, SourceEntry};
pub use checkpoint_coordinator::{
    CheckpointConfig, CheckpointCoordinator, CheckpointPhase, CheckpointResult, CheckpointStats,
    WalPrepareResult,
};
pub use config::{IdentifierCaseSensitivity, LaminarConfig};
pub use db::LaminarDB;
pub use error::DbError;
pub use handle::{
    DdlInfo, ExecuteResult, FromBatch, PipelineEdge, PipelineNode, PipelineNodeType,
    PipelineTopology, QueryHandle, QueryInfo, SinkInfo, SourceHandle, SourceInfo, StreamInfo,
    TypedSubscription, UntypedSourceHandle,
};
pub use metrics::{PipelineCounters, PipelineMetrics, PipelineState, SourceMetrics, StreamMetrics};
pub use pipeline_checkpoint::PipelineCheckpoint;
pub use profile::{Profile, ProfileError};
pub use recovery_manager::{RecoveredState, RecoveryManager};

/// Re-export the connector registry for custom connector registration.
pub use laminar_connectors::registry::ConnectorRegistry;
