/**
 * adapters/broker/ibkr — public surface of the IB Gateway face.
 *
 * Two landed layers, both READ-ONLY:
 *  - the TWS-socket TRANSPORT (kestrel-7o2.5): connect / auth / heartbeat / status / config;
 *  - the CONTRACT-RESOLUTION layer (kestrel-7o2.6): a Kestrel identity → the gateway's OWN contract
 *    definition. A TRANSMITTER, never a re-pricer — the resolved {@link IbkrContract} carries NO
 *    price field of any kind — and fail-closed: an ambiguous/unresolvable identity is a LOUD typed
 *    {@link IbkrContractError} that routes to STAND_DOWN, never a guessed contract.
 *
 * Neither places an order (order submission is 7o2.8 paper / 7o2.10 live, behind the human-signed
 * arm envelope). The config/redaction discipline mirrors the lake accessor; every non-determinism
 * source (socket, clock, timers, request ids) is injected so none leaks onto the deterministic core.
 */

export {
  resolveIbkrConfig,
  describeIbkrConfig,
  redactAccount,
  IBKR_DEFAULT_HOST,
  IBKR_DEFAULT_PORT,
  IBKR_DEFAULT_CLIENT_ID,
  IBKR_DEFAULT_MODE,
} from "./config.ts";
export type { IbkrConfig, IbkrConfigInput, IbkrMode } from "./config.ts";

export { IbkrConfigError, IbkrConnectionError, IbkrContractError } from "./errors.ts";
export type { IbkrFailure, IbkrContractFailure } from "./errors.ts";

export {
  resolveContract,
  resolveUnderlier,
  resolveOptionChain,
  listOptionStrikes,
  contractClientOf,
  IB_NO_SECURITY_DEFINITION,
  IBKR_DEFAULT_EXCHANGE,
  IBKR_DEFAULT_CURRENCY,
} from "./contract.ts";
export type {
  IbkrContract,
  IbkrEquityContract,
  IbkrIndexContract,
  IbkrUnderlierContract,
  IbkrQuotedContract,
  UnderlierSecType,
  IbkrOptionContract,
  IbkrOptionChain,
  IbkrChainQuery,
  IbkrContractDeps,
  IbContractClient,
} from "./contract.ts";

export {
  ibkrFeed,
  feedFair,
  feedClientOf,
  resolveFeedContracts,
  stalenessGatedProvider,
  IbkrFeedError,
  DEFAULT_STALE_AFTER_MS,
  DEFAULT_SUBSCRIBE_TIMEOUT_MS,
  WIDE_SPREAD_RATIO,
} from "./feed.ts";
export type {
  IbkrFeed,
  IbkrFeedConfig,
  IbkrFeedDeps,
  IbFeedClient,
  FeedSubscription,
  FeedOpenResult,
  FeedFair,
  FeedFairInput,
  FeedFairQuery,
  FairFallback,
  FeedHealth,
  FeedWatermark,
  FeedSeriesWatermark,
  FeedContractQuery,
  QuoteHealth,
  SpreadRegime,
  SubscriptionState,
  WatermarkSource,
} from "./feed.ts";

/** THE ONE SURFACE-WINDOW RULE (kestrel-7o2.19) — the ATM-centred window off the venue's LISTED grid,
 * and the honest ATM-coverage fit quality. The feed and the order path share this and nothing else. */
export {
  surfaceWindow,
  atmListedStrike,
  atmCoverage,
  atmTaint,
  IbkrSurfaceWindowError,
  DEFAULT_SURFACE_HALF_WIDTH,
  DEFAULT_ATM_BAND_FRACTION,
} from "./surface-window.ts";
export type {
  SurfaceWindow,
  SurfaceWindowInput,
  AtmCoverage,
  AtmCoverageInput,
  AtmPolicy,
} from "./surface-window.ts";

export { IbRequestRouter, IbkrRequestError, describeIbErrorCode, IB_CONNECTION_REQ_ID } from "./requests.ts";
export type { IbErrorBus, RequestErrorSink } from "./requests.ts";

export { IbkrTransport } from "./transport.ts";
export type {
  BrokerStatus,
  IbClient,
  IbkrTransportDeps,
  Scheduler,
  TimerHandle,
  NowFn,
} from "./transport.ts";
