/**
 * When true, the BNPL domain is served by the in-memory mock (`apis/mockApi.ts`) behind the `BnplApi`
 * seam.
 *
 * **Mock is still primary** (blocker-phase 05 landed Bug A — the seeded BNPL gateway — but not Bug B):
 * the D1 wizard hard-gates on `getBnplOptions` (`GET checkout_bnpl/options/{id}`), and `getBnplSchedule` /
 * `getWalletInstallments` have no server counterpart either — `CheckoutBnplController` only ever grew
 * `eligibility` / `initiate` / `GET {id}` / `by_request/{id}` (REQ-022/023/024 never landed). Flipping this
 * flag today trades the old "mock store ages out" failure for an immediate `isError` on D1. Flip once those
 * three endpoints exist server-side — no hook/component change needed at that point.
 */
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';
