import type { EarningsState } from './types'; /** * React Query key factory for the payouts domain (hierarchical, per the `services/{domain}` pattern). * * The **state filter and page are part of the key** so switching the earnings tab or paging never refetches * data already in cache (reverting to a viewed tab is a cache hit); the summary, each earnings tab, each * history page, and each payout detail all key independently. */ export const payoutKeys = { all: ['payouts'] as const, earningsSummary: () => [...payoutKeys.all, 'earnings_summary'] as const, earningsLists: () => [...payoutKeys.all, 'earnings'] as const, /** `state` is `'all'` for the unfiltered tab, else the `EarningsState`; `page` keeps pages separate. */ earningsList: (state: EarningsState | 'all', page: number) => [...payoutKeys.earningsLists(), state, page] as const, historyLists: () => [...payoutKeys.all, 'history'] as const, history: (page: number) => [...payoutKeys.historyLists(), page] as const, details: () => [...payoutKeys.all, 'detail'] as const, detail: (payoutId: number) => [...payoutKeys.details(), payoutId] as const, };