/**
 * When true, the BNPL domain is served by the in-memory mock (`apis/mockApi.ts`) behind the `BnplApi`
 * seam.
 *
 * **Mock is primary this phase.** b12 ships the eligibility/initiate/webhook/settle endpoints server-side,
 * but the D1–D5 checkout cannot run real end-to-end from the client yet:
 *  - the accepted request being financed comes from the **mock-primary** `bookingRequests` store (f7), so a
 *    real `initiate` would reference an id that exists only in memory (same reason f9 payment is mock-primary);
 *  - the contract serves **no provider/plan options** (D1/D2), **no repayment schedule** (D4 — the contract
 *    explicitly does not model the customer's repayment schedule), and **no provider-reported installment
 *    status** for the Wallet (D5) → REQ-022/023/024;
 *  - nothing fires the provider webhook in dev, so a real order would never settle.
 * The mock closes the loop: the settle (down-payment cleared) converts the f7 request, inserts a **confirmed**
 * booking into the f8 store (the SAME bridge f9 uses — a settled BNPL order is a card payment net-of-fee),
 * and seeds a Wallet installment plan — so C6 → D1 → … → D4 → confirmation → D5 demos end-to-end. Flip to
 * `false` once the upstream domains are real and REQ-022/023/024 land — no hook/component change.
 */
export const USE_BNPL_MOCK = true;

/** Options/eligibility/schedule are short-lived (prices/deadlines move between visits). */
export const BNPL_OPTIONS_STALE_TIME = 10 * 1000;
export const BNPL_SCHEDULE_STALE_TIME = 30 * 1000;

/** The provider-reported Wallet status is moderately fresh — a plan does not change second-to-second. */
export const BNPL_WALLET_STALE_TIME = 60 * 1000;

/** The settle poll after the provider return (mirrors f9's bounded backoff — «received ≠ settled»). */
export const BNPL_ORDER_POLL_BASE_MS = 2 * 1000;
export const BNPL_ORDER_POLL_GROWTH = 1.5;
export const BNPL_ORDER_POLL_MAX_MS = 15 * 1000;
export const BNPL_ORDER_POLL_MAX_ATTEMPTS = 40;

/** BNPL checkout deep-link query params (C6 hands off `request_id`; the handoff round-trip carries the rest). */
export const BNPL_QUERY_REQUEST_ID = 'request_id';
export const BNPL_QUERY_TRANSACTION_ID = 'transaction_id';
export const BNPL_QUERY_PROVIDER = 'provider';
export const BNPL_QUERY_PLAN = 'plan';
export const BNPL_QUERY_OUTCOME = 'outcome';

/** The `method` flag the reused f9 confirmation reads to render «پرداخت‌شده با اقساط». */
export const CHECKOUT_QUERY_METHOD = 'method';
export const CHECKOUT_METHOD_BNPL = 'bnpl';

/**
 * National-ID format: 10 digits (client-side validation only — the real credit check is the provider's;
 * D3 surfaces the provider's verdict, it never pre-judges eligibility).
 */
export const NATIONAL_ID_LENGTH = 10;
export const NATIONAL_ID_PATTERN = /^\d{10}$/;

/**
 * Mock-only credit ceiling + declined-path triggers (see `apis/mockApi.ts`). The ceiling is what a real
 * provider would return per its own credit model; the client never derives it. Declined paths are keyed
 * deterministically off the entered national ID so a tester can exercise both branches (§7 step 3).
 */
export const MOCK_CREDIT_CEILING_IRR = '2000000000'; // 200,000,000 Toman (matches the contract example)
/** A national ID whose last digit is 0 → `not_eligible`; otherwise eligible unless the order exceeds the ceiling. */
export const MOCK_NOT_ELIGIBLE_LAST_DIGIT = '0';
