//! # clock-bigint
//!
//! Deterministic constant-time big integers for blockchain consensus engines.
//!
//! This crate implements the ClockinChain Big Integer specifications:
//! - Representation Specification v1.0
//! - Arithmetic Algorithm Specification v1.0
//! - Montgomery & Modular Exponentiation Specification v1.0
//! - Gas Schedule Specification v1.0
//!
//! ## Features
//!
//! - **Deterministic**: Bit-for-bit identical results across all platforms
//! - **Constant-time**: All operations execute in constant time to prevent timing attacks
//! - **Canonical encoding**: Unique representation for each integer value
//! - **Gas metering**: Precomputable gas costs for VM execution
//! - **Montgomery arithmetic**: Full support for cryptographic operations
//!
//! ## Example
//!
//! ```rust
//! use clock_bigint::U256;
//!
//! let a = U256::from_u64(10);
//! let b = U256::from_u64(20);
//! // Operations will be implemented...
//! ```

#![no_std]
#![warn(missing_docs)]
#![warn(clippy::all)]

#[cfg(feature = "alloc")]
extern crate alloc;

pub mod ct;
pub mod error;
pub mod gas;
pub mod limbs;
pub mod types;

#[cfg(feature = "alloc")]
pub mod add;
#[cfg(feature = "alloc")]
pub mod div;
#[cfg(feature = "alloc")]
pub mod encode;
#[cfg(feature = "alloc")]
pub mod modexp;
#[cfg(feature = "alloc")]
pub mod montgomery;
#[cfg(feature = "alloc")]
pub mod mul;
#[cfg(feature = "alloc")]
pub mod sub;
#[cfg(feature = "alloc")]
pub mod timeboxed;

#[cfg(feature = "zk")]
pub mod zk;

// Re-export commonly used types
pub use error::{BigIntError, Result};
pub use gas::{G_BASE, Gas, MAX_LIMBS};
pub use limbs::{Limb, WideLimb};
#[cfg(feature = "alloc")]
pub use types::BigInt;
pub use types::{BigIntCore, BigIntFixed, U256, U512, U1024, U2048};

// Re-export arithmetic operations
#[cfg(feature = "alloc")]
pub use add::{add, add_assign, add_magnitude};
#[cfg(feature = "alloc")]
pub use div::{div, div_assign, div_rem, rem, rem_assign};
#[cfg(feature = "alloc")]
pub use mul::{mul, mul_assign, sqr};
#[cfg(feature = "alloc")]
pub use sub::{sub, sub_assign, sub_magnitude};

// Re-export encoding operations
#[cfg(feature = "alloc")]
pub use encode::{decode, encode};

// Re-export Montgomery operations
#[cfg(feature = "alloc")]
pub use modexp::mod_pow;
#[cfg(feature = "alloc")]
pub use montgomery::{
    MontgomeryContext, from_mont, mont_add, mont_mul, mont_reduce, mont_sub, to_mont,
};

// Re-export timeboxed operations
#[cfg(feature = "alloc")]
pub use timeboxed::{modexp_timeboxed, mul_timeboxed, resume};
#[cfg(feature = "alloc")]
pub use timeboxed::{ContinuationState, OpType, PartialResult};

#[cfg(feature = "zk")]
pub use zk::{ZKBackend, ZKBigInt};
