import type { Order, OrderListFilter, Page } from '@platform-modules/commerce-orders'

/**
 * Injected, DB-free data seam for browser-side order reads (§2).
 * The host wires each method to an API route it owns; the route derives the
 * actor from the authenticated session (NEVER a client-supplied param — §0.3
 * IDOR floor) and calls the core getOrderById/listOrders, then runs the
 * exported reviveOrder/reviveOrderPage helpers (§3) before returning the typed
 * value. The one production transport is HTTP; an in-process core wrapper and a
 * mock are test doubles, not production adapters. `actor`/`db` are bound
 * host-side and never appear here.
 */
export interface OrdersClient {
  /** Typed order detail; null = not found OR caller not entitled (core collapses both → null). */
  getOrderById(id: string): Promise<Order | null>
  /** Typed page of orders for the authenticated caller. */
  listOrders(filter?: OrderListFilter): Promise<Page<Order>>
}
