import { queryOptions } from '@tanstack/react-query' import { api } from '@/lib/api-client' import type { TaxExemption } from '@/types/account' import type { PaginatedResponse, PaginationInput } from '@lunarfront/shared/schemas' export const taxExemptionKeys = { all: (accountId: string) => ['accounts', accountId, 'tax-exemptions'] as const, list: (accountId: string, params: PaginationInput) => [...taxExemptionKeys.all(accountId), params] as const, } export function taxExemptionListOptions(accountId: string, params: PaginationInput) { return queryOptions({ queryKey: taxExemptionKeys.list(accountId, params), queryFn: () => api.get>(`/v1/accounts/${accountId}/tax-exemptions`, params), }) } export const taxExemptionMutations = { create: (accountId: string, data: Record) => api.post(`/v1/accounts/${accountId}/tax-exemptions`, data), update: (id: string, data: Record) => api.patch(`/v1/tax-exemptions/${id}`, data), approve: (id: string) => api.post(`/v1/tax-exemptions/${id}/approve`, {}), revoke: (id: string, reason: string) => api.post(`/v1/tax-exemptions/${id}/revoke`, { reason }), }