/**
 * When true, the admin domain is served by the in-memory mock (`apis/mockApi.ts`) behind the `AdminApi`
 * seam. **Mock is primary this phase:** the b1 config/holiday/audit/support-alert endpoints are live and
 * the real `clientApi.ts` maps them 1:1, but (a) config `updatedAt/updatedBy` and the actor/action/date
 * audit filters aren't on the wire yet (REQ-029/030) and (b) the RBAC role endpoints don't exist in the
 * b15 contract at all (REQ-031). The mock supplies a realistic, filter-exercising world for every console;
 * flip to `false` per area once each upstream is complete — the swap is the one line in `apis/index.ts`.
 */
export const USE_ADMIN_MOCK = true;

/** Worklist page sizes (api-conventions `pageSize`, default 50 / max 100). */
export const ADMIN_PAGE_SIZE = 20;
export const AUDIT_PAGE_SIZE = 25;

/**
 * Config + holidays are near-static reference data — a long `staleTime` avoids refetching on revisit; a
 * mutation invalidates the relevant key so the change shows immediately. Audit + support-alerts move at
 * ops speed (moderate staleness). All are gc'd after a few minutes off-screen.
 */
export const ADMIN_CONFIG_STALE_TIME = 5 * 60 * 1000;
export const ADMIN_HOLIDAYS_STALE_TIME = 5 * 60 * 1000;
export const ADMIN_AUDIT_STALE_TIME = 30 * 1000;
export const ADMIN_ALERTS_STALE_TIME = 20 * 1000;
export const ADMIN_GC_TIME = 5 * 60 * 1000;

/** Config keys that are **rates** and must validate to the closed-open interval [0, 1). */
export const RATE_CONFIG_KEYS: readonly string[] = [
  'platform_fee_rate',
  'vat_rate',
];

/** Grouping of config keys into UI sections (any key not listed falls into "other"). */
export const CONFIG_GROUPS: Record<string, readonly string[]> = {
  fees: ['platform_fee_rate', 'vat_rate'],
  deadlines: ['dispute_window_hours', 'nurse_payout_interval_days', 'payout_satna_threshold_irr', 'booking_request_response_deadline_minutes', 'payment_window_minutes'],
  evv: ['evv_location_tolerance_meters'],
  bnpl: ['bnpl_provider_enabled', 'bnpl_min_amount_irr'],
  cancellation: ['cancellation_tier1_refund_rate', 'cancellation_tier2_refund_rate', 'cancellation_tier3_refund_rate'],
};
