//! `cow-orderbook` — Layer 4 `CoW` Protocol orderbook API client for the `CoW` Protocol SDK.
//!
//! This crate provides the HTTP client ([`OrderBookApi`]) for interacting
//! with the `CoW` Protocol orderbook REST API, plus all request/response
//! types and quote-amount calculation helpers.
//!
//! # Submodules
//!
//! | Module | Purpose |
//! |---|---|
//! | [`api`] | [`OrderBookApi`] async HTTP client with typed endpoint methods |
//! | [`types`] | Request/response structs (`OrderQuoteRequest`, `Order`, `Trade`, …) |
//! | [`quote_amounts`] | Fee breakdown, slippage, and cost-stage calculations |
//!
//! # Quick start
//!
//! ```rust,no_run
//! use cow_chains::{Env, SupportedChainId};
//! use cow_orderbook::OrderBookApi;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let api = OrderBookApi::new(SupportedChainId::Mainnet, Env::Prod);
//! let version = api.get_version().await?;
//! println!("orderbook version: {version}");
//! # Ok(())
//! # }
//! ```

#![deny(unsafe_code)]
#![warn(missing_docs)]
// `generated.rs` is autogenerated OpenAPI code — exempt from some lints.
#![allow(
    clippy::missing_errors_doc,
    clippy::missing_panics_doc,
    clippy::doc_markdown,
    reason = "progenitor-generated code does not satisfy workspace lints"
)]

pub mod api;
pub mod client_trait;
pub(crate) mod generated;
pub mod quote_amounts;
pub mod types;

pub use client_trait::OrderbookClient;
// Re-export the L3 rate limit primitives for backwards compatibility —
// these types moved down to `cow-http`.
pub use cow_http::{DEFAULT_RETRY_STATUS_CODES, RateLimiter, RetryPolicy, rate_limit};

#[cfg(test)]
mod wire_compat;

pub use api::{OrderBookApi, mock_get_order, request};
pub use quote_amounts::{
    PartnerFeeResult, ProtocolFeeAmountParams, QuoteAmounts, QuoteAmountsAndCostsParams,
    QuoteAmountsAndCostsResult, QuoteCosts, QuoteFeeComponent, QuoteNetworkFee, QuoteOrderParams,
    get_protocol_fee_amount, get_quote_amounts_after_partner_fee, get_quote_amounts_after_slippage,
    get_quote_amounts_and_costs, transform_order,
};
pub use types::{
    AppDataObject, Auction, CompetitionAuction, CompetitionOrderStatus, CompetitionOrderStatusKind,
    EthflowData, GetOrdersRequest, GetTradesRequest, InteractionData, OnchainOrderData, Order,
    OrderCancellations, OrderClass, OrderCreation, OrderInteractions, OrderQuoteRequest,
    OrderQuoteResponse, OrderStatus, OrderUid, QuoteData, QuoteSide, SolverCompetition,
    SolverExecution, SolverSettlement, TotalSurplus, Trade, is_eth_flow_order,
};
