/**
 * When true, the payment domain is served by the in-memory mock (`apis/mockApi.ts`) behind the
 * `PaymentApi` seam.
 *
 * **Mock is primary this phase.** The b10 `initiate` endpoint and the b11 `invoices/{bookingId}` read are
 * live server-side, but the checkout cannot run real end-to-end from the client yet:
 *  - the accepted request being paid comes from the **mock-primary** `bookingRequests` store (f7), so a
 *    real initiate would reference an id that exists only in memory;
 *  - the contract serves **no checkout summary** (gross/commission/VAT for C6 — REQ-016) and **no
 *    client-readable transaction status** for the return poll (REQ-017);
 *  - nothing fires the PSP webhook in dev (b10's mock provider returns a fake redirect URL and the
 *    "webhook simulator" is a manual server-side POST), so a real payment would never confirm.
 * The mock closes the loop: capture converts the f7 request, inserts a **confirmed** booking into the f8
 * store, and issues the invoice — so C5 → C6 → gateway → confirmation → booking detail demos end-to-end.
 * Flip to `false` once the upstream domains are real and REQ-016/017 land — no hook/component change.
 */
export const USE_PAYMENT_MOCK = false;

/**
 * f11 wired the BNPL method screens (D1–D5): C6's «پرداخت اقساطی» seam now navigates into the installment
 * wizard (`ROUTES.CHECKOUT_BNPL`) instead of rendering a disabled "coming soon" secondary.
 */
export const BNPL_ENABLED = true;

/** Prices/deadlines can move between visits — keep the checkout summary short-lived. */
export const CHECKOUT_SUMMARY_STALE_TIME = 10 * 1000;

/** An issued invoice is immutable — cache it for the session. */
export const INVOICE_STALE_TIME = 60 * 60 * 1000;

/**
 * The pending-callback poll ("PSP received ≠ cash in bank" — a pending state is normal, reflect it
 * calmly). Starts at ~2s, grows geometrically, caps, and gives up after a bounded number of attempts —
 * never a tight loop. Terminal statuses stop the poll regardless (see `usePaymentOutcome`).
 */
export const PAYMENT_OUTCOME_POLL_BASE_MS = 2 * 1000;
export const PAYMENT_OUTCOME_POLL_GROWTH = 1.5;
export const PAYMENT_OUTCOME_POLL_MAX_MS = 15 * 1000;
export const PAYMENT_OUTCOME_POLL_MAX_ATTEMPTS = 40;

/** Checkout deep-link query params (C5 hands off `request_id`; the gateway round-trip carries the rest). */
export const CHECKOUT_QUERY_REQUEST_ID = 'request_id';
export const CHECKOUT_QUERY_TRANSACTION_ID = 'transaction_id';
export const CHECKOUT_QUERY_BOOKING_ID = 'booking_id';
export const CHECKOUT_QUERY_OUTCOME = 'outcome';

/**
 * Mock-only money rates. `MOCK_PLATFORM_FEE_RATE` matches the f8 seeds' snapshotted `platformFeeRate`
 * (0.12); `MOCK_VAT_RATE` is the current 10% VAT (product: VAT applies to **Balinyaar's commission
 * only** and the rate is config-driven server-side — b11 serves `vatRate`/`vatIrr`; the client never
 * derives tax on the real path).
 */
export const MOCK_PLATFORM_FEE_RATE = 0.12;
export const MOCK_VAT_RATE = 0.1;
